Problem

Source: Baltic Way 2017 Problem 19

Tags: number theory



For an integer $n\geq 1$ let $a(n)$ denote the total number of carries which arise when adding $2017$ and $n\cdot 2017$. The first few values are given by $a(1)=1$, $a(2)=1$, $a(3)=0$, which can be seen from the following: \begin{align*} 001 &&001 && 000 \\ 2017 &&4034 &&6051 \\ +2017 &&+2017 &&+2017\\ =4034 &&=6051 &&=8068\\ \end{align*}Prove that $$a(1)+a(2)+...+a(10^{2017}-1)=10\cdot\frac{10^{2017}-1}{9}.$$