Recursive Digit Sum

Given a positive integer n n , let S ( n ) S(n) denote the digit sum of n n . Consider the sequence of numbers given by

{ n 1 = S ( n ) n k = S ( n k 1 ) k 2 \begin{cases} n_1 = S(n) \\ n_k = S(n_{k-1} ) & k \geq 2 \\ \end{cases}

For how many positive integers n 2013 n \le 2013 does the sequence { n k } \{ n_k \} contain the number 9 9 ?


The answer is 223.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Jaydee Lucero
Dec 9, 2013

The recursive formula looks frustrating, but by deeply analyzing it, the point of the formula is that the next term of the sequence can be obtained by adding the digits of the previous term . For instance, let n = 63859 n=63859 Then n 1 = S ( n ) = 6 + 3 + 8 + 5 + 9 = 31 n_1=S(n)=6+3+8+5+9=31 , n 2 = S ( n 1 ) = 3 + 1 = 4 n_2=S(n_1)=3+1=4 and so on.

Now, for this problem, we are asked for the number of n n whose one term in n k {n_k} by the recursive formula is 9, that is, there is one time that the sum of the digits of the previous term is 9. Recall the divisibility rule of 9: A number is divisible by 9 if and only if the sum of its digits is also divisible by 9. Therefore, it follows that to get a 9 in the sequence, n n must be divisible by 9, and the number of integers n n divisible by 9 is

2013 9 = 223 \left \lfloor \frac{2013}{9} \right \rfloor = \boxed{223} .

You have to be careful with your reasoning. The number 0 is a multiple of 9, but the sequence does not contain the number 9. Why must the number 9 eventually appear?

How would you fix your solution to account for this?

Calvin Lin Staff - 7 years, 6 months ago

Log in to reply

I doubt if this is right: Maybe I must also indicate that n n is given to be a positive integer, so that 0 can be excluded in consideration.

Jaydee Lucero - 7 years, 6 months ago

I am not convinced.

A Former Brilliant Member - 7 years, 6 months ago

The above sequence is of the sum of digits of the previous number and the question was the sequence should contain the number 9 regardless where it appears. The term 19 also contains the number 9. So why the numbers having digit sum 19 have not been included.?

Jeet Patel - 7 years, 6 months ago

Log in to reply

Because the 9 in 19, in this sense, is a digit. I thought the problem asks for the number of positive integer n < 2013 n<2013 such that the sequence contains the number 9, that is, 9 is a term in the sequence, and in this case I got the answer.

Jaydee Lucero - 7 years, 6 months ago

In order to get the digit sum of 9, the sum must be wither 9, 18, or 27. Since we have maximum number in the given which is a four-digit number, the maximum digit is 28 and the minimum is 1.

The answer is simple. We can find such numbers which are simply divisible by 9. Hence, there are 223 numbers from 9 to 2007 inclusive.

How would you prove it? And why the sum can be either 9, 18 or 27?

Jubayer Nirjhor - 7 years, 5 months ago
Jubayer Nirjhor
Dec 14, 2013

First let's consider the general decimal representation of an n n -digit positive integer...

i = 0 n a i + 1 1 0 i Digit sum: i = 0 n a i + 1 \sum_{i=0}^{n} a_{i+1}10^i ~~~~~~~~~~~~~~ \text{Digit sum:} ~~~ \sum_{i=0}^{n}a_{i+1}

Since i = 0 n a i + 1 1 0 i i = 0 n a i + 1 ( m o d 9 ) \text{Since}~~~~~~\sum_{i=0}^{n} a_{i+1}10^i\equiv \sum_{i=0}^{n}a_{i+1}\pmod{9}

So if i = 0 n a i + 1 0 ( m o d 9 ) \text{So if}~~~~~~~ \sum_{i=0}^{n}a_{i+1}\equiv 0 \pmod{9}

Then i = 0 n a i + 1 1 0 i 0 ( m o d 9 ) \text{Then}~~~~~~~~~~~ \sum_{i=0}^{n} a_{i+1}10^i\equiv 0 \pmod{9}

Thus, for the digit sum of a positive integer to be divisible by 9 9 , the number itself must be divisible by 9 9 . And thus we can also see that according to the recurrence relation given in the question, the digit sum of all the positive integers divisible by 9 9 will eventually become 9 9 .

Hence, the answer is simply...

2013 9 = 233 \left\lfloor \dfrac{2013}{9}\right\rfloor = \fbox{233}

Tarush Tiwari
Dec 10, 2013

On observing the sequence of numbers whose sum of digits give 9. we get the following numbers- 9,18,27,36,45..........so on. As these numbers are multiples of 9. Just divide 2013 by 9 and the quotient is the answer.

Can you explain your thinking step by step?

The number 189 doesn't have a digit sum of 9. Why should it be included in the count?

Calvin Lin Staff - 7 years, 6 months ago
Nick Steichen
Dec 9, 2013

2013%9=6 2013-6=2007 2007/9=223

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...