We are given $2$ integers, $a,b$ such that $0\leq\,a$ and $b\leq9)$, that are the first $2$ elements of a series. Each consecutive term of the series is defined as the sum of all the previous elements of the series, modulo $10$. That is, the first element is $a$, the second element is $b$, the third element (let's call it $c$) is $(a+b)\%10$, the fourth element is $(a+b+c)\%10$, where $c= (a+b)\%10$, and so on. If the series contains $n$ elements, how do I find the sum of the series?
One way to do this is just calculate every term and find the sum,
but in my case $n$ could be very large, so I need something better than this.
After some calculation , I found that for any given $a$ and $b$,
3rd element $= (1*(a+b))\%10$
4th element $= (2*(a+b))\%10$
5th element $= (4*(a+b))\%10$, and so on, but I'm still not able to generate a formula for the sum for the first $n$ terms.
As you stated, let
$$c = (a+b)\%10 \tag{1}\label{eq1}$$
Next, let $f_i$, for $i \ge 1$, be the elements of the series, so $f_1 = a$, $f_2 = b$, $f_3 = c$ and, in general, for $i \ge 3$, you get
$$f_i = \left(2^{i-3}c\right)\%10 \tag{2}\label{eq2}$$
Next, note that $2^{5+j} = 32 \times 2^j \equiv 2 \times 2^j \equiv 2^{j+1} \pmod{10}$ for $j \ge 0$. Thus, this shows the values in \eqref{eq2} start repeating, with a period of $4$, beginning at $i = 4$. You can therefore determine the sum $S_n$ based on the value of $n$ being less than $4$ (i.e., $S_1 = a$, $S_2 = a + b$, $S_3 = a + b + c$), else its value based on its quotient and remainder modulo $4$.