# Prove that the last digit of $\frac{n(n+1)}{2}$ is never 9

The original question was

If the last digit of $$\sum_1^n n^3$$ is 1, then the last digit of $$\sum_1^n n$$ is ______?

The sum of the cubes of natural numbers is equal to the square of the sum of the natural numbers. Since the last digit of the sum of cubes is 1, the last digit of the sum of numbers can be either 1 or 9. Substituting n=1..13 in the formula $$\frac{n(n+1)}{2}$$ gives numbers which end in 1, but never a number ending in 9. The answer key also mentions the answer to be 1, but not 9.

Please conclusively prove why $$\sum_1^n n$$ can never end with a 9.

## 4 Answers

We compute all the possible residues $$n(n+1)\bmod10$$, which are $$[0, 2, 6, 2, 0, 0, 2, 6, 2, 0]$$. If the last digit of $$\frac{n(n+1)}2$$ was a $$9$$, the last digit of $$n(n+1)$$ would be $$8$$, but since $$8$$ does not appear as a possible value of $$n(n+1)\bmod10$$, $$9$$ cannot be the last digit of $$\frac{n(n+1)}2$$.

If $$\dfrac{n(n+1)}2=r, 8r+1=(2n+1)^2$$

Now for any odd number $$2n+1, (2n+1)^2\equiv1,5,9\pmod{10}$$

$$8r+1\equiv1,5,9\pmod{10}$$

$$\iff8r\equiv0,4,8\pmod{10}$$

$$\iff4r\equiv0,2,4\mod5$$

$$\iff r\equiv0,3,1\pmod5$$

$$\implies r\equiv0,0+5,3,3+5,1,1+5\pmod{10}$$

For the last digit of $$\frac{n(n+1)}{2}$$ to be $$9$$, $$n^{2}+n+2$$ must be divisible by $$5$$ but $$n^{2}+n+2\equiv m\mod{5}, m\in\{2,3,4\}$$.

For this thing $$\dfrac{n(n+1)}{2}$$ to end in a $$9$$ then $$n(n+1)$$ has to end in $$18$$ of sorts. Literally. Because you could have $$n$$ and $$n+1$$ having unit digits that multiply to $$18$$. $$8$$ is also a possibility since $$18 \equiv 8 \bmod 10$$.

These two numbers can't be expressed as the product of two consecutive numbers. Which in this case would be the unit digits of $$n$$ and $$n+1$$

Q.E.D