# What is $x$, if $1! + 2! + 3! + \cdots + (x-1)! + x! = k^2$ and $k$ is an integer?

What is $$x$$, if $$1! + 2! + 3! + \cdots + (x-1)! + x! = k^2$$ and $$k$$ is an integer?

Using trial and error, it is obvious that for $$x < 4$$, the given equation has solutions only for $$x = 1,k = \pm1$$ and $$x=3, k = \pm 3$$. Where to go from here?

• A more general question is handled here
– lulu
Oct 4, 2020 at 22:27

It can be proved that for $$x \ge 4$$, no solutions exist. The expressions

\begin{aligned}1! + 2! + 3! + 4! &= 33 \\ 1! + 2! + 3! + 4! + 5! &= 153 \\ 1! + 2! + 3! + 4! + 5! + 6! &= 873 \\ 1! + 2! + 3! + 4! + 5! + 6! + 7! &= 5913\end{aligned} end with the digit $$3$$. Now, for $$x \ge 4$$ the last digit of the sum $$1! + 2! + 3! + \cdots + x!$$ is equal to 3 and therefore, this sum cannot be equal to a square of a whole number $$k$$ (because the square of a whole number cannot end with $$3$$).

Therefore, $$1$$ and $$3$$ are the only solutions for $$x$$.

• You have given particular samples only. How can we gaurantee that in general "for x≥4 the last digit of the sum 1!+2!+3!+⋯+x! is equal to 3"
– Mick
Oct 5, 2020 at 5:37
• @Mick For $n \ge 5$, $n!$ ends with the digit 0. Oct 5, 2020 at 7:52
• I see what you mean now but if that comment has been included in your post, the deduction will be much clearer.
– Mick
Oct 5, 2020 at 17:10