What is known about sequences $a_{n}$ such that $\sum_{n=1}^{N}(-1)^{a_{n}}n = 0$?

89 Views Asked by At

The question I am really asking is, how many sequences $a_{n}$ satisfy the inequality for a given $N$. Clearly the number is even due to the symmetry of the problem. Also there is no solutions for $N\equiv 1 \mod 4$ or $N\equiv 2 \mod 4$ since the number of the first $N$ natural numbers is odd in these cases (you cannot halve the amount into a positive and negative set).

So for example:

$N=3\Longrightarrow$ $$1 + 2 - 3=0 \quad\quad -1 - 2 + 3=0$$ $N=4\Longrightarrow$ $$+1 - 2 - 3 +4=0 \quad\quad -1 + 2 + 3 -4=0$$ $N=5\Longrightarrow$ $$\text{No solutions.}$$ $N=6\Longrightarrow$ $$\text{No solutions.}$$ $N=7\Longrightarrow$ $$\geq 4 \,\,\text{cases, don't want to write them out.}$$

1

There are 1 best solutions below

0
On BEST ANSWER

I assume that we let $a_n = \{0, 1\}$, or else the number of solutions is obviously infinite.

The number of different $a_n$ is equal to the number of different subsets of $\{1, \dots, n\}$ that sum to $\frac{1}{4}n(n+1)$. As you've noticed, this is only possible when $n \bmod 4 \in \{0, 3\}$.

This is also equivalent to the number of integer partitions of $\frac{1}{4}n(n+1)$ where each part is distinct and at most $n$. Luckily, this has a simple generating function form:

$$[z^{n(n+1)/4}]\prod_{k=1}^n(1 + z^k)$$ This gives initial values:

$$2, 2, 0, 0, 8, 14, 0, 0, 70, 124, 0, 0, 722, 1314$$

Which leads to the correct OEIS sequence: A063865.