15

OEIS sequence A245869 is titled "T(n,k)=Number of length n+2 0..k arrays with some pair in every consecutive three terms totalling exactly k".

Thus, for example, $T(2,3) = 100$ because there are exactly $100$ arrays consisting of $2+2=4$ numbers from $\{0,1,2,3\}$ with at least one pair in every consecutive $3$ terms totalling $3$. For example, $[1,2,1,0]$ is included because in the first $3$ terms we have $1 + 2 = 3$ and in the second $3$ we have $2 + 1 = 3$. But $[1,0,1,2]$ is not included because in the first $3$ terms we have no pair summing to $3$.

"Empirical" recurrence formulas for the first $9$ columns are listed in the OEIS entry, e.g. for column 3 we have $a(n) = 2 a(n-1)+2 a(n-2)-a(n-3)$. I have been able to verify, using linear algebra, each of these column recurrence formulas and more. That is, for each $k$ I construct a $(k+1)^2$ by $(k+1)^2$ matrix $M$ such that $a(n) = e^T M^n e$, where $e$ is a $(k+1)^2$-dimensional vector of all $1$'s. The recurrence formula then corresponds to $P(M) e = 0$ where $P$ is a polynomial. It soon becomes apparent that there is a pattern for $k \ge 3$:

If $k\ge 3$ is odd, the recurrence is $a(n) = 2 a(n-1)+(k-1) a(n-2)-a(n-3)$.

If $k\ge 4$ is even, the recurrence is $a(n) = 3 a(n-1)+(k-1) a(n-2)-a(n-3) - (2k-3) a(n-4) - (k^2-2k) a(n-5) + (k-1) a(n-6)$.

It is a routine Maple computation to verify this for any particular $k$ (as long as the matrix is not too big to fit in the computer). But I don't see how to prove that the pattern holds for all $k$. Can anyone help?

Robert Israel
  • 470,583

1 Answers1

6

Here is a fairly mechanical way to derive the recurrences.

I'll start with the case where $k$ is odd. For an array $A = (A_1, \dots, A_n)$ with the given property, define $\mathrm{State}(A)$ as the 3-tuple of booleans:

$$(A_1 + A_2 = k, A_1 + A_3 = k, A_2 + A_3 = k).$$

Write $a_S(n) = \#\left\{A: \mathrm{State(A)} = S\right\}$. Of course $a_{000} = 0$. Also $a_{111} = 0$ because there is no way to have integers such that $A_1 + A_2 = A_2 + A_3 = A_1 + A_3 = k$ if $k$ is odd. The following recurrences can be derived by analyzing all the cases where a new number is added to the front of an array:

$$\begin{align} a_{001}(n) &= (k-1)a_{100}(n-1) + (k-1)a_{101}(n-1) + (k-1)a_{110}(n-1)\\ a_{010}(n) &= a_{001}(n-1) + a_{010}(n-1) \\ a_{100}(n) &= a_{001}(n-1) + a_{010}(n-1) \\ a_{101}(n) &= a_{100}(n-1) + a_{101}(n-1) + a_{110}(n-1) \\ a_{011}(n) &= a_{100}(n-1) + a_{101}(n-1) + a_{110}(n-1) \\ a_{110}(n) &= a_{011}(n-1) \\ \end{align}$$The problem is now reduced to linear algebra and you can solve it the same way you did, except now there are 6 equations instead of $(k+1)^2$. The matrix satisfies $A^6 - 2A^5 - (k-1)A^4 + A^3 = 0$ so we have $a(n+6) = 2a(n+5) + (k-1)a(n+4) - a(n+3)$ which is the desired recurrence.

For the case of even $k$ we need more states. The previous analysis fails when deriving the recurrences -- it is no longer enough to know that $A_1 + A_2 = k$; you also need to know whether $A_1 = A_2$.

Sadly, I fear the margin is too small to contain the proof, but I think a 6-bit state should do it: $$\mathrm{State}(A) = \left(A_1 + A_2 = k, A_1 + A_3 = k, A_2 + A_3 = k, A_1 = \frac{k}{2}, A_2 = \frac{k}{2}, A_3 = \frac{k}{2}\right).$$ Of course most of the combinations are not actually possible, so in the end there will be a 13-dimensional system or something like that.

anon
  • 466