You may also like

problem icon

More Mods

What is the units digit for the number 123^(456) ?

problem icon

N000ughty Thoughts

Factorial one hundred (written 100!) has 24 noughts when written in full and that 1000! has 249 noughts? Convince yourself that the above is true. Perhaps your methodology will help you find the number of noughts in 10 000! and 100 000! or even 1 000 000!

problem icon

Mod 3

Prove that if a^2+b^2 is a multiple of 3 then both a and b are multiples of 3.

Squaresearch

Stage: 4 Challenge Level: Challenge Level:1

Pete Inglesby from Wolverhampton; Patrick Snow, age 16, Dame Alice Owens School, Potters Bar; Yatir Halevi, age 18, Maccabim-Reut High-School, Israel; Andrei Lazanu, age 12, School 205, Bucharest, Romania all solved this problem. Here is Pete's solution:

Consider numbers of the form

$$ u(n) = 1! + 2! + 3! +...+ n!. $$

How many such numbers are perfect squares?

In fact only when $n=1$ or $n=3$ does $u(n)$ give a perfect square ($1$ and $9$ respectively).

The solution lies in the fact that all factorials above $5!$ are multiples of $10$. This is because they all have $2$ and $5$ as prime factors. For $n> 5$

$$\eqalign { n!&=1 \times 2\times 3\times 4\times 5\times \cdots \times n \cr &= 2\times 5(1\times 3\times 4\times \cdots \times n) \cr &= 10(1\times 3\times 4\times \cdots n).}$$

When adding a multiple of $10$, to another integer, $k$, the last digit of $k$ will remain the same. Suppose $k = 10j + l$ and $m =10n$, with $l$ and $n$ integers, then $k + m = 10(j + n) + l$.

So when adding all factorials equal to or higher than $5!$ then you are adding a multiple of ten, so the last digit of the sum will be the same. This is important because the last digit of $u(4)$ is a $3$. We have $u(4) = 1! + 2! + 3! + 4! = 1 + 2 + 6 + 26 = 33$. Therefore for any $u(n)$ with $n> 5$ the last digit will be $3$. For any integer $p = (10a + b)$ with $a$ and $b$ integers and $b< 10$, $p^2 = (100a^2 + 20ab + b^2)$. Therefore the last digit is of $p^2$ is only dependent on $b^2$.
b b2 Last digit of b2
0 0 0
1 1 1
2 4 4
3 9 9
4 16 6
5 25 5
6 36 6
7 49 9
8 64 4
9 81 1

This table shows that the squares of all integers between $0$ and $9$, and therefore all integers, end in either $1$, $4$, $5$, $6$ or $9$.

No perfect squares end in $3$. Therefore, $u(n)$ with $n > 4$ can never be a perfect square as it has been shown to always end in $3$.

All that remains is to find $u(n)$ for all integers of $4$ or less:

$u(1) = 1! = 1$;
$u(2) = 1! + 2! = 3$;
$u(3) = 1! + 2! + 3! = 9$;
$u(4) = 1! + 2! + 3! + 4! = 33.$

Only $u(1)$ and $u(3)$ are perfect squares, and so they are the only sums of factorials to be perfect squares.