# Remainder when $N$ is divided by '$9$'

$N$ is a natural number formed by writing, in the ascending order, the first $1002$ whole numbers one after the another. Find the remainder when $N$ is divided by $9$

It is known that if the summation of digits of $N$ is divisible by $9$, then $N$ is. Otherwise, summation when done recursively until it can be divided by $9$ easily, remainder then obtained will be the remainder when $N$ is divided by $9$. I can't figure out how to find summation of the digits of the number $N$.

• Possible hint/starting point. Solve the problem for the first $10$ numbers, the first $12$, the first $100$ and some other smaller numbers that will help you see a pattern. Nov 8 '17 at 14:04
• Why put quotation marks around 9 in the title?
– hola
Nov 8 '17 at 18:09

You can write your number as the sum $\sum_{i=1}^{1002} i*10^{a_i}$ where $a_i$ is the number of digits away from the decimal place you've written your $i$. Because $10\equiv 1 \pmod 9$, we know that the remainder upon division by $9$ is the same as the remainder upon division by $9$ of $\sum_{i=1}^{1002} i=\frac{(1002)(1002+1)}{2}$.
As far as 9 is concerned, there’s no difference between adding numbers and adding up all their digits. For example, $24+39=63$ and $2+4+3+9=18$; either way, it’s a multiple of $9$.
Now the sum $1+\cdots +9$ is a multiple of $9$. So is $10+\cdots +18$. Indeed, for any $k$, we have that $(9k+1)+\cdots +(9k+9)$ is a multiple of $9$, and therefore, so is its digit sum. This applies to every run of $9$ in your total. The last multiple of $9$ under $1002$ is $999$, so you really only need to check the numbers past that point:
$$1+0+0+0+1+0+0+1+1+0+0+2=6$$