Is there $n \geq 2$ such that $1^1 + 2^2 + \dots + n^n$ is a perfect square?

322 Views Asked by At

Define $S_n = 1^1 + 2^2 + 3^3 + \dots + (n - 1)^{n - 1} + n^n$. It is clear that $S_1 = 1^1 = 1$ is a perfect square. However, I have found no others so far.

Question: Does there exist $n \geq 2$ such that $S_n$ is a perfect square?

I have checked via computer that there are no solutions for $2 \leq n \leq 3000$. Analysis modulo $3$ reveals that $$n \equiv 2,3,5,6,10,13 \pmod{18} \Rightarrow S_n \equiv 2 \pmod{3},$$ and hence $S_n$ is not a perfect square for these values of $n$. I imagine one could do similar analysis using other moduli, but it does not seem to eliminate many values of $n$.

I currently do not have a great reason for believing that the answer to the question is no, but I also have no idea how, aside from burning my CPU, to show that the answer could be yes. Any other ideas would be greatly appreciated.

(I even tried searching for perfect powers in general, and have so far only found $$S_3 = 2^5$$ as an example.)

Edit 1: The analysis done modulo 3 can be replicated for other moduli, and this can actually be useful if you are trying to search for solutions by computer. I make a useful conjecture:

Conjecture: The residues of $S_n$ modulo an odd prime $p$ are periodic (over consecutive integers $n$) with period $p^2(p - 1)$. Furthermore, there are exactly $p(p - 1)^2/2$ residues of $n$ modulo $p^2(p - 1)$ which imply $S_n$ to not be congruent to a quadratic residue modulo $p$.

Thus, we can identify, based on the residue of $n$ modulo $p^2(p - 1)$, whether $S_n$ is congruent to a quadratic residue modulo $p$. This is beneficial since I imagine computing $n$ mod $p^2(p - 1)$ is faster than checking whether $S_n$ is a perfect square.

With this "result" applied to only the first six odd primes $3,5,7,11,13,17$ (I have verified the conjecture is true for these), it appears we already can say that for about $96.4 \%$ of the natural numbers, $S_n$ is not a perfect square. You could probably show this rigorously via the Chinese Remainder Theorem, but whatever. (And of course, I imagine the more primes you use, the better the results, but at some point too many modulus operations becomes a burden.)