TITLE: Asymptotic growth of a certain integer sequence
QUESTION [24 upvotes]: Some time ago, while putting my nose in the Sloane's Online Encyclopedia of Integer Sequences, I came over the sequence A019568 defined as follows:

$a(n):=$ the smallest positive integer $k$ such
  that the set $\{1^n, 2^n, 3^n,\dots k^n\}$ can be partitioned into two
  sets with equal sum.

In other words, $a(n)$ is the smallest $k$ such that there is a choice of signs + or - in the expression  $$1^n\pm2^n\pm\dots\pm k^n \qquad\qquad(1) $$ that makes it vanish. In order to show that this $a(n)$ is a well-defined integer (that is: that at least one such $k$ does exist), a simple observation gives in fact a bound $$a(n)<2^{n+1}.$$ Reason: $(1-x)^{n+1}$ divides the polynomial 
$$Q(x):=(1-x)(1-x^2)(1-x^4)\dots(1-x^{2^n})=+1-x-x^2+x^3-\dots +(-1)^n x^{2^{n+1}-1},$$
therefore, if $S$ is the shift operator on sequences, the operator $Q(S)$ has the $(n+1)$-th discrete difference $(I-S)^{n+1}$ as factor, hence annihilates any sequence that is polynomial of degree not greater than $n$. In particular, the algebraic sum (1) with the signs of the coefficients of $Q(x)$ vanishes (incidentally, the sequence of signs is the so called Thue-Morse sequence A106400, $+--+-++--++-+--+\dots$.
However, looking at the reported values of $a(n)$ for $n$ from $0$ to $12:$  
$$2,\ 3,\ 7,\ 12,\ 16,\ 24, \ 31,\ 39,\ 47,\ 44,\ 60,\ 71,\ 79,$$ 
it looks like the growth of $a(n)$ is much below $2^{n+1}$ (I have a weakness for sequences that grow slowly, here's possibly the main motivation of this question).

Question: Does anybody have a reference for the
  above sequence? Can you see how to
  prove an asymptotics, or a more
  realistic bound than $a(n)<2^{n+1}$?

REPLY [4 votes]: This is building off of the work of Richard Borherds' answer and the comment I made there.  We can provide a way to compute an upper bound which would be much better than the current exponential bound in $n$, but relies on enumerating solutions to certain Diophantine equations.
We are going to try and enumerate the distinct values of the expression $$e_11^n+e_22^n+\cdots+e_kk^n,$$ where $e_i = \pm 1$ for $i \in [1,n]$.  Let $S$ be the set of all values attained by this expression.  We have obviously $|S| \le 2^k$ as there are $2^k$ ways to choose the signs, but we know that two different choices for the $e_i$ may give the same numeric value.  An illustrative example occurs in case $(k,n) = (5,2)$, where we have $$+1^2+2^2+3^2+4^2-5^2 = +1^2+2^2-3^2-4^2+5^2 = 5.$$  If we have two choices for the $e_i$ - for now, call the two lists of coefficients $a_i$ and $b_i$ that coincide, we may form sets $A = \{i \in [1,n]: a_i = +1, b_i = -1\}$ and $B = \{i \in [1,n]: a_i = -1, b_i = +1 \}$.  Then we know that $A \cap B = \emptyset$, and more importantly, $\sum_{a\in A}a^n = \sum_{b \in B}b^n$.
Now define a function $s(k,n,a,b)$, with $a \ge b$ and $a+b \le k$, to count the number of pairs of sets $(A,B)$ satisfying the following conditions:

$A \cup B \subseteq [1,k]$;
$A \cap B = \emptyset$;
$|A| = a$ and $|B| = b$;
if $a = b$, then $\max{A} < \max{B}$;
$\sum_{a\in A}a^n = \sum_{b \in B}b^n$.

Then we may write $$|S| \ge 2^k - \sum_{m=3}^k2^{k-m-1}\sum_{1 \le j \le m/2}s(k,n,m-j,j).$$  Indeed, we see that if some set of choices of $e_i$ give the same numerical value, all but one will be removed by this inclusion-exclusion counting.  We may simplify this a bit further by writing $$f(k,n) = \sum_{m=3}^k2^{-m-1}\sum_{1 \le j \le m/2}s(k,n,m-j,j)$$ as our equation then becomes $|S| \ge 2^k(1-f(k,n))$.  Now once we have established suitable bounds on $f(k,n)$, we may proceed as Richard did, noting that we simply solve for the least valid value of $k$ in the inequality $$2^k(1-f(k,n)) \ge 2\sum_{i=1}^ki^n.$$
Where does Fermat's Last Theorem come in?  Well, in case $n \ge 3$, we need only sum from $m = 4$ to $k$ - there are no solutions for $m = 3$, as a solution for $m = 3$ takes the form $x^n + y^n = z^n$!  So we lose what is (possibly?) the largest contributing term to $f(k)$.
EDIT: I was off by a factor of two.  Darn.