# How many numbers between $1$ and $123456789$ have digital root equal to $5$?

$S(n)$ is a function. If applied to a number, it sums up all the digits until a single digit is obtained. e.g.: $S(919)=S(9+1+9)=S(19)=S(1+9)=S(10)=1+0=1$

Find how many such numbers exists if $1\lt n\lt 123456789$ and $S(n)=5$.

-

The function $S$ gives the remainder when dividing the number by $9$, except that it gives $9$ instead of $0$ when the number is divisible by $9$; this is also known as the digital root of $n$. So your question is exactly the same as asking how many numbers of the form $9k+5$ are there strictly between $1$ and $123456789$.

-
thanks for giving such a good imformation. so its solution is 13717420 –  rohit Aug 7 '11 at 19:02
\begin{align} \quad \; 111 & \qquad (1 + 1 + 1 = 3) \\ + \; 234 & \qquad (2 + 3 + 4 = 9 \to 0) \\ = \; 345 & \qquad (3 + 4 + 5 = 12 \to 3) \end{align}