Let S ( n ) denote the sum of the digits of an positive integer n .
Find the smallest positive integer k such that S ( 1 8 k ) > 1 8 .
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.
Great approach using the rules of divisibility to set up the conditions which avoids having to slowly search through all positive integers.
sorry i can't understand how u brought S(18k)=27,and can't we just use sum of an n terms of an AP(Arithmetic progresssion) to get it.
Log in to reply
Digit sum of a multiple of 9 must be divisible by 9 , therefore digit sum of a multiple of 1 8 must also be divisible by 9 . Therefore, S ( 1 8 k ) , which is digit sum of 1 8 k must be = 9 , 1 8 , 2 7 , . . . . As the maximum of digit sum increases with the number of digit. Therefore, the smallest 1 8 k must have a digit sum of 2 7 , it cannot be any number from 1 9 to 2 6 .
Python 2.7:
1 2 3 4 5 6 7 8 |
|
A number with two digits will have maximum sum of the digits as 9+9=18. ..So k must at lest be three digit. Now, for n from 1 to 10, 18 * n the total of digits is 9. While for n=11, 18 * 11=198, and 100 * 18=1800. So (11 +100) * 18=198+1800=1998, sum of digits >18. S o k = 1 1 1
Problem Loading...
Note Loading...
Set Loading...
Since 1 8 k is divisible by 9 , this means that S ( 1 8 k ) must be a multiple of 9 . For the smallest k such that S ( 1 8 k m ) > 1 8 , means that S ( 1 8 k m ) = 2 7 .
That smallest n such that S ( n ) = 2 7 is n = 9 9 9 . Since 1 8 k m is even, 1 8 k m must be at least a 4 -digit integer. The smallest 4 -digit even integer such that S ( n ) = 2 7 is n = 1 9 9 8 and since 1 9 9 8 = 1 1 1 × 1 8 is divisible by 1 8 , then k m must be 1 1 1 .