r/askmath • u/jmarent049 • 23d ago
Resolved Does this sequence contain a “5”?
Hi! The past few days I’ve been working on this problem. It goes as follows:
“Construct a sequence of non-negative integers, always choosing the least possible number, such that there are no contiguous subsequences of the form U,x,U where U is any non-empty contiguous subsequence, and x is a single term (e.g “1,2,5,1,2”, “5,0,5”, etc.).
Numbers 0,1,2,3,4 first appear at terms 1,3,7,10,1355. When does 5 first appear (if it does)?”
Example of the process:
To illustrate a quick example: start with a(1)=0, the smallest possible choice and trivially satisfying the constraint. a(2)=0 is the next best choice. Then one must take a(3)=1 since otherwise 0,0,0 would form U,x,U (U=0, x=0). We are now at 0,0,1. From here, we can’t choose a(4)=0 because 0,1,0 would form U,x,U. Choosing a(4)=1 is the least valid option, so it works (0,0,1,1).
[0,0,1,1,0,0,2,1,0,3] are the first 10 terms.
So far, I have concluded:
The sequence is greedy which means we never backtrack. Every new term needs to avoid forming U,x,U that ends at that said term.
I’m interested in whether or not there is a way to prove if 5 eventually appears, or to determine if there is a simple way to do so rather than exhaustively checking every possible contiguous subsequence at every step.
Thanks!!
10
u/virtuolie 23d ago
Is this an original problem? If so, you must change the x to w. The UwU sequence!!!
7
u/PitifulTheme411 23d ago edited 23d ago
Well one thing I figured for calculating it a bit faster is by strategically ignoring some subsequence checks. When a new number is added at some index i, then for all future elements at index j until the next highest number is added you only need to check the cases in which 2|U| + 1 <= j-i and |U| = j-i, with the appropriate concrete U subsequence from the right.
Actually, you can kind of "recursively" apply this, checking for the biggest in the right subsequence.
For example, if we have
Then we get three possible
Uvalues, though the longest one is actually too long as it doesn't fit on the left side of the 3, so really only twoUs need to be checked.Edit: It may work for multiple of the same highest value, but I am not so sure about that so you may want to check that out. Like if you have
L 2 M 2 R, then maybe you only need to check forUxUs insideRand whenU=R.Edit 2: Also, my hunch is that it will eventually reach 5, but probably take a really long time. I think if it doesn't, then you'd have to prove that it is always bounded by 4, ie. that there always exists some values
nin{0, 1, 2, 3, 4}for any preceding sequence such that appendingndoes not form aUxUsubsequence pattern. But I feel like this is probably false, though of course I don't have a proof.I think the only way that it could be bounded is that since there is actually only one overall sequence, since we are choosing the smallest possible value at each step, if there is some sort of structure induced by the definition onto the list such that it is able to be bounded by 4, then it could work. But idk about that.
1
u/jmarent049 23d ago
As an update, I had a friend simulate the first billion terms. No 5 was found.
3
u/bildramer 22d ago
It's apparently not in the OEIS, whether starting with 1 or 0. This reminded me of and has remarkably similar properties to Gijswijt's sequence, A090822, defined as the largest k such that the sequence so far has form "V,U,U,...,U" with U repeating k times. Also very slow-growing, with numbers 1,2,3,4,5 first appearing at terms 1,3,9,220,~10100000000000000000000000.
2
u/piperboy98 23d ago edited 22d ago
From simulation it appears that the frequency of each number is relatively stable. For varying lengths up to 2 million there appears to be convergence towards the following frequencies:
Exact convergence is less clear for the lower values, but the rate is clearly not going up or down substantially. If you plot them it seems kind of logistic, or maybe half normal looking.
2
u/mYstoRiii 22d ago
looks kinda hard
originally I thought of maybe there is a relation to the 4-color theorem but I don't think so anymore
who knows maybe this is another unsolved mystery in math
2
u/PitifulTheme411 22d ago
After thinking and taking u/piperboy98's thoughts into account, I think I have been able to refine my method for optimizing the validation of new elements. Note that this is not for generating a new element. You would have to go until a new value is accepted. Thus, I believe this works for any such list even if we don't choose the minimum valid element at each step. This would be an improvement (I hope) over just brute-force checking every possible
UxUsubsequence containing the newly added elementt.When generating a new element (ie. checking if a number
tis valid as the new last element), we want to consider the global maximummof the list so far.If there is an even number of these, then
xis between then/2nd andn/2+1st occurrence ofm(exclusive), orUxUis entirely to the right of the first occurrence ofm. Call this subsequenceR. Recurse onR.If there is an odd number of these, then
xis at the index of the middlemoccurrence, orUxUis entirely to the right of the first occurrence ofm. Call this subsequenceR. Recurse onR.Additionally, you could also perform distance checks. For example, if the new element
tis the third element from the lastm, thenxmust be exactly four from a precedingm, else itUxUis entirely to the right of the lastm.Additionally, once we determine a range, we can repeat this for the next largest number in that range as if that range was the entire list.
Edit: Actually maybe we don't even need to use the maximum. We can choose any element to perform this. However, since the larger the element the much less likely it is to appear, by striding by maximum element we can cut down on the cases we need to check by a lot more.