Sum of last digits of a sum 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.
 A: 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.
A: Ok So note the following things for $n=20m$ 
$$d_{n+1}+d_{n+2}...+d_{n+4}=10 \\ 
d_{n+5}+d_{n+6}...+d_{n+15}=50  \\ 
d_{n+16}+d_{n+16}...+d_{n+20}=10$$
Can you use this to calculate the result?


*

*Note that $n=20m\implies \mod(S_n, 10)=0$. Now $$S_{n+1}=S_n+20m+1 \\ S_{n+1}=1\mod(10) \\ S_{n+2}=3\mod(10) \\ S_{n+3}=6\mod(10) \\ S_{n+4}=0\mod(10)$$

*Note that $n=20m+15\implies\mod(S_n,10)=0$, so similar to above argument we can find the sequence form $S_{n+5}$ to $S_{n+15}$.

*Same argument work for $S_{n+16}$ to $S_{n+20}$.


So to answer the question $\sum_1^{2000}d_i=70\times\frac{2000}{20}=7000$, $\sum_{2001}^{2015}d_i=60$, $d_{2016}=6, d_{2017}=3$
Hence $T=\sum_{2001}^{2017}d_i=7069$, $T\%1000=69$
A: continuing
$$0,1,3,6,0,5,1,8,6,5,5,6,8,1,5,0,6,3,1,0,0,1・・・$$
You can find something.
A: In general, if $f(x)\in\mathbb{Q}[x]$ is an integer-valued polynomial of degree $d$ and $m$ is a positive integer, then
$$f\big(n+d!\,m\big)\equiv f(n)\pmod{m}$$
for every $n\in\mathbb{Z}$.  Hence, $d!\,m$ is a (not necessarily minimal) period of $\big(f(n)\big)_{n\in\mathbb{Z}}$ modulo $m$.  To prove this, it is well known that
$$f(x)=\sum_{k=0}^d\,t_k\,\binom{x}{k}$$
for some $t_0,t_1,t_2,\ldots,t_k \in\mathbb{Z}$.  Thus, $F(x):=d!\,f(x)$ is a polynomial with integral coefficients.  It is also commonly known that, for $g(x)\in\mathbb{Z}[x]$, $g(n+N)\equiv g(n)\pmod{N}$ for any $n\in\mathbb{Z}$ and $N\in\mathbb{Z}_{>0}$.  That is,
$$F(n+d!\,m)\equiv F(n)\pmod{d!\,m}\,.$$
Dividing both sides by $d!$, noting that $d!\mid F(n)$ and $d!\mid F(n+d!\,m)$, we obtain the desired result.
Now, since $S_n=\dfrac{n(n+1)}{2}$ is an integer-valued polynomial of degree $2$, we see that $S_n$ in modulo $10$ is periodic with period $2!\cdot 10=20$.  The rest is just as other users have concluded.
