Prove $N_n \equiv\frac{n(n+1)}{2}\mod 9$

156 Views Asked by At

Prove $$N_n \equiv\frac{n(n+1)}{2}\mod 9$$ where $N_n$ is the number obtained by writing 1 to n one after the other. For example, $$N_{12} = 123456789101112$$

My Attempt: First, I listed the first ones: $$N_1=1\equiv 1\mod 9$$ $$N_2=12\equiv 3\mod 9$$ $$N_3=123\equiv 6\mod 9$$, and the remainder did match the pattern $\frac{n(n+1)}{2}$. So I tried to do proof by induction. Assume $$N_k \equiv\frac{k(k+1)}{2}\mod 9$$, then I figured out that $$N_{k+1} = 10^{\lfloor \log_{10}(k+1)+1\rfloor}N_k + k+1$$, so I need to prove $$10^{\lfloor \log_{10}(n+1)+1\rfloor}N_k + k+1 \equiv \frac{(k+1)(k+2)}{2} \mod 9 $$ But got lost from here...Maybe induction is not the best way to proof this.

2

There are 2 best solutions below

0
On BEST ANSWER

Hint Since $10 \equiv 1 \pmod{9}$, for any $k$ you have $$10^kN_n+(n+1) \equiv N_n +(n+1) \pmod{9}$$

0
On

$10^k \equiv 1 \pmod{9}$ for any $k\ge 0$. So, we can write $N_n$ as $$1\cdot 10^0+ 2 \cdot 10^1 + \dots +10^kn$$ for some $k$ that depends on the number of digits of $n$, but the value is immaterial since mod $9$ we get $$1 + 2 +\dots + n = \frac{n(n+1)}{2}.$$