[Math] Sum of last digits of a sum

divisibilitysequences-and-seriessummation

Let $d_n$ be the last digit of $S_n$ where $S_n = \left(1 + 2 + 3 + …. + n\right)$. Find the remainder when $\sum_{i=1}^{2017}d_i$ is divided by 1000.

My attempt : I found the following
$$S_1 =1 , d_1 =1
\\S_2 =3 , d_2 =3
\\S_3 =6 , d_3 =6
\\S_4 =10 , d_4 =0
\\S_5 =15 , d_5 =5
\\S_6 =21 , d_6 =1
\\S_7 =28 , d_7 =8
\\S_8 =36 , d_8 =6
\\S_9 =45 , d_9 =5
\\S_{10} =55 , d_{10} =5
$$
I was expecting to get a sequence, but did not find any. Please help me to solve this question.

Best Answer

The $S_n$ are the triangular numbers and their last digit is given by

$$\frac{n(n+1)}2\bmod10,$$ which is

$$\left(\frac n2\bmod10\right)((n+1)\bmod10)\bmod10$$ for even $n$ and $$\left(\frac {n+1}2\bmod10\right)(n\bmod10)\bmod10$$ for odd $n$. Hence the sequence has period $20$, with a sum of $70$.

Then the sum

$$\sum_{i=1}^{2017}\frac{n(n+1)}2\bmod10$$

has $100$ complete periods and $17$ remaining terms, $7069$ in total.

Related Question