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.