1

We let $a_0 = 0, a_1 = 0, a_n=\text{mex}(\{a_i+a_{n-i-2},i=0\ldots n-2\}),n\geq2$. Now suppose we need to calculate $a_n$ for large $n$ and fast. There have got to be certain shortcuts for that - like being able to move from $a_n$ to $a_{2n}$ in one step or having a closed form for some of these numbers for some $n$s. That's what I'm interested in. Thanks.

EDIT: For those who are new to this whole Nimber thing, as I am, $\text{mex}$ stands for "minimally excluded" and returns minimal non-negative number that is not in the given set. For example, $\text{mex}(\{1,2,4\})=0$ and $\text{mex}(\{0,2,5\})=1$. Also, nimber-addition is just bitwise-xor, so plus-sign in the formula can be changed for $\oplus$. Now if we go back to my sequence, we would have $$ a_2=\text{mex}(\{0\oplus0\})=1, $$ $$ a_3=\text{mex}(\{0\oplus0,0\oplus0\})=1, $$ $$ a_4=\text{mex}(\{0\oplus1,0\oplus0,1\oplus0\})=2. $$ Similarly, $a_5=0,a_6=3,a_7=1$, and so on.

user75619
  • 827

1 Answers1

1

This sequence is naturally identical to the sequence of nimbers for a heap game in which, on your turn, you can remove $2$ items from a heap and then optionally split the remainder into two separate heaps of arbitrary sizes. That heap game is extremely famous, and is known as Dawson's Kayles, or "the heap game with Octal code 0.07". Equivalently, you can imagine this game as placing dominoes on a line of boxes, as in this other MSE question.

Very briefly, nimber sequences like this often become periodic after a while, and there is a theorem that says they definitely become periodic if they look like they do. This makes it very easy to calculate your sequence for large $n$ quickly. For some more information, see this community wiki collection of tutorials about nimbers and octal games.

As mentioned in my answer to that other question, a nearly identical sequence is at OEIS entry A002187, except the sequence there is missing the $a_0=0$ term. For completeness, here is the beginning of your sequence, with $8$ exceptional terms underlined. There are no more exceptions; it continues on with period $34$: \begin{array}{r|cccc} n & \text{0+} & \text{34+} & \text{68+} & \text{102+} \\ \hline 0 & \underline{0} & 4 & 4 & 4 \\ 1 & \underline{0} & \underline{0} & 8 & 8 \\ 2 & 1 & 1 & 1 & 1 \\ 3 & 1 & 1 & 1 & 1 \\ 4 & 2 & 2 & 2 & 2 \\ 5 & 0 & 0 & 0 & 0 \\ 6 & 3 & 3 & 3 & 3 \\ 7 & 1 & 1 & 1 & 1 \\ 8 & 1 & 1 & 1 & 1 \\ 9 & 0 & 0 & 0 & 0 \\ 10 & 3 & 3 & 3 & 3 \\ 11 & 3 & 3 & 3 & 3 \\ 12 & 2 & 2 & 2 & 2 \\ 13 & 2 & 2 & 2 & 2 \\ 14 & 4 & 4 & 4 & 4 \\ 15 & \underline{0} & 4 & 4 & 4 \\ 16 & 5 & 5 & 5 & 5 \\ 17 & \underline{2} & 5 & 5 & 5 \\ 18 & \underline{2} & \underline{2} & 9 & 9 \\ 19 & 3 & 3 & 3 & 3 \\ 20 & 3 & 3 & 3 & 3 \\ 21 & 0 & 0 & 0 & 0 \\ 22 & 1 & 1 & 1 & 1 \\ 23 & 1 & 1 & 1 & 1 \\ 24 & 3 & 3 & 3 & 3 \\ 25 & 0 & 0 & 0 & 0 \\ 26 & 2 & 2 & 2 & 2 \\ 27 & 1 & 1 & 1 & 1 \\ 28 & 1 & 1 & 1 & 1 \\ 29 & 0 & 0 & 0 & 0 \\ 30 & 4 & 4 & 4 & 4 \\ 31 & 5 & 5 & 5 & 5 \\ 32 & \underline{2} & 3 & 3 & 3 \\ 33 & 7 & 7 & 7 & 7 \end{array}

Mark S.
  • 23,925