# How to prove that the number $1!+2!+3!+...+n!$ is never square?

How to prove that the number $1!+2!+3!+...+n! \ \forall n \geq 4$ is never square?

I was told to count permutations but I cannot figure out what we are permuting.... Thanks!

• My apologies, for n>3 Apr 19, 2011 at 18:16

The first few cases are easily dealt with: $1!=1$ and $1!+2!+3!=9$ are squares, while $1!+2!=3$ is not.

For $n \ge 4$, $1!+2!+3!+ \ldots + n!$ is congruent to 3 mod 5. But all squares are congruent to 0, 1, or 4 mod 5.

• Or in simpler terms, a perfect square never ends in 3 (i.e talking mod 10 instead of mod 5). Apr 19, 2011 at 18:11

Firstly, it's only true for n > 3. Secondly, I don't see how to do it with permutations.

But the key is to consider residue classes mod 10. $1! + 2! + ... + n!$ is congruent to either 3 or 8 mod 10, but no square ends in either 3 or 8.

• It is always $3$, never $8$, when $n>3$, isn't it? May 31, 2012 at 19:05
• When is it 8 ? Isn't it always 3 mod 10 ?
– Ali
Oct 24, 2020 at 5:16

You can also use mod $7$ to solve this.

Firstly, manually checking $n=1,2,3,4,5$ gives only the solutions $n=1$, $n=3$.

If $n\ge 6$, then $$1!+2!+\cdots+n!$$

$$\equiv 1!+2!+3!+4!+5!+6!\pmod{7}$$

$$\equiv 5\equiv m^2\pmod{7},$$

contradiction, because $5$ is not a quadratic residue mod $7$ (notice $(7k\pm 1)^2\equiv 1\pmod{7}$, $(7k\pm 2)^2\equiv 4\pmod{7}$, $(7k\pm 3)^2\equiv 2\pmod{7}$).

mod $13$ would also work analogously. If $n\ge 12$, then $$1!+2!+\cdots+n!$$ $$\equiv 1!+2!+\cdots+12!\equiv 11\pmod{13}$$

and $11$ is not a quadratic residue mod $13$.

Using this method mod $9$ or mod $11$ wouldn't work (the residues would be $0$, which is a square mod every integer).

mod $17$ would also work -- the residue would be $12$, which is not quadratic mod $17$.

• By your method it is quite evident that we can use other congruences than $\pmod7$.... Jun 15, 2016 at 13:39
• @tatan mod $9$ or mod $11$ would give $0$ and wouldn't work analogously ($0$ is a quadratic residue mod everything). Jun 15, 2016 at 13:39