Doesn't seem possible

Let N N be the smallest positive integer for which the digit sum of N N and the digit sum of N + 1 N+1 are both divisible by 50 50 . How many digits of N N are 9?

Details and assumptions

The digit sum of a number is the sum of all its digits. For example the digit sum of 1123 is 1 + 1 + 2 + 3 = 7 1 + 1 + 2 + 3 = 7 .


The answer is 43.

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.

9 solutions

Clare Ford
Dec 16, 2013

Clearly the last digits of N must all be 9s. If the last digit of N is not a 9 then the digit sum of N + 1 will be one more than the digit sum of N, in which case it is impossible for the digit sums of both N and N + 1 to be divisible by 50. Similarly, N can not have just one 9 at the end, as the digit sum of N + 1 would then be (1 - 9 =) 8 less than the digit sum of N. So how many 9s are needed at the end of N?

When we add 1 to N the 9s will disappear and the digit that precedes the series of 9s will be incremented by 1. Since 50|N+1, we know that the sum of the digits preceding the 9s must be congruent to 49 modulo 50, and so the sum of 9s must be congruent to 1 modulo 50. Say N ends with n 9s. We want n to satisfy 9n = 50m + 1 for some integer m. Since gcd(50, 9) = 1, we can use the Extended Euclidean Algorithm (I'll skip the steps) to obtain n = 39, so the last 39 digits of N must be 9s.

Now we need to find the preceding digits. We want to find the smallest positive integer N with this property, so we want to minimize the number of digits that N has. The sum of the preceding digits must be congruent to 49 mod 50, so to make N as small as possible, the preceding digits will have a sum of 49. The first preceding digit should be as high as possible, but it can't be a 9, so it must be an 8. Then we can have 4 9s and then a 5 to sum to 49.

Hence N is 599998999..99 (with 39 9s at the end) which has 39 + 4 = 43 digits which are 9.

I like your solution; I had a similar method of solving the problem

Sam Thompson - 7 years, 4 months ago

One comment It asked for the smallest N so I am somewhat confused as 699989=N then it is smallest and thus it is 4 am I missing something here? Can someone please explain?

Daniel Lee - 7 years, 4 months ago

Log in to reply

N and N+1 must be divisible by 50; The digit sum of 699990 is 42, which is clearly not divisible by 50

Sam Thompson - 7 years, 4 months ago

Nice use of the Extended Euclidean algorithm.................

Eddie The Head - 7 years, 4 months ago
Steven Perkins
Dec 16, 2013

In most cases, adding 1 to N simply increases the digit sum by 1. This clearly won't satisfy the problem at hand!

But if N ends in 9, adding 1 changes the trailing 9 to 0, thus reducing the digit sum! This is our path to a solution then. We have to keep in mind that we "carry the one" from the addition, so we subtract 9, but add 1 to the digit sum.

A single 9 at the right of our sought after N isn't enough then. We must reduce the digit count by 50...well at least a multiple of 50. Since the problem asks us how many 9s, we have a clue that leads us to think that if N ends in a string of 9s, then adding 1 makes them all turn to 0 and adds to the first non-9 digit. Now we have a plausible construction method.

The digit sum for N+1 will be 9m-1 less than the digit sum for N. 9m-1 also must be a multiple of 50 to satisfy the conditions of the problem. So we seek a multiple of 9 of the form 51, 101, 151, 201... that is a multiple of 9. Remembering that a number is evenly divisible by 9 if and only if its digit sum is divisible by 9, our first candidate (by trial and error) is 351 = 9*39.

But wait. A number consisting of 39 9s has a digit sum of 351 as we've just seen. Our starting N must have a digit sum that is a multiple of 50. Hmmm. We can't waste digits because we must find the smallest candidate as well. I'm guessing we'll need more 9s. We can't spoil our pattern of 39 9s at the end either.

With a bit of thought, we soon see that tacking on 599998 (digit sum 49) to the left of our 39 9s when added to the digit sum of 351 we already had gives us 400 (a multiple of 50) and it should be the smallest we can form that does what we need.

Yes, that must be it! Those extra 4 9s give us a total of 43 \boxed{43} and that is the solution.

Isik Oz
Dec 17, 2013

In order for both N N and N + 1 N+1 to be divisible by 50 50 , the difference between the digit sums of these two numbers must also be divisible by 50 50 .

Then these two numbers must be in the form: N = [ . . ] X 9 [ 9..9 ] 9 N = [..]X9[9..9]9 and N + 1 = [ . . . ] ( X + 1 ) [ 0..0 ] 0 N+1 = [...](X+1)[0..0]0

The difference of digit sums of these two numbers are: ( n × 9 ) 1 (n\times 9) - 1 where n n is the number of consecutive 9 9 s at the very end of the N N (or conversely the number of consecutive 0 0 s at the end of N + 1 N+1

Smallest integer n n that satisfies ( 9 × n ) 1 (9\times n) - 1 a dividend of 50 50 is 39 39 .

Since we found the number of 9 9 s, now we must find the left side of the number. The digit sum of the right hand side is 351 351 and 1 1 for N N and N + 1 N+1 respectively. The left part of the number then must have a digit sum of at least 49 49 . Moreover, this number may not have 9 9 in the rightmost digit, since then the total number of digits that change during the addition (from N N to N + 1 ) N+1) increases. The smallest such number is: 599998 599998 .

The number we are looking for is: 599998 [ 9..9 ] 599998[9..9] which has 43 \boxed{43} 9 9 s.

Happy Melodies
Dec 16, 2013

Notice that normally (when the unit digit is not 9 9 ), we would expect the digit sum of N N and N + 1 N+1 to have a difference of 1 1 ------ when this occurs, the unit sums of both N N and N + 1 N+1 cannot be divisible by 50 50 , in other words they will not have the same modulo 50 50 . Thus, we can conclude that the unit digit (and possibly the last few digits are 9 9 ).

Let g ( X ) g(X) represents the unit sum of a number X X . Notice that when only the unit digit of a number X X is 9 9 , g ( X + 1 ) g(X+1) will be 9 1 = 8 9-1 =8 less than g ( X ) g(X) ------ since the unit digit of X + 1 X+1 changes from 9 9 to 0 0 and the second last digit (not 9 9 ) increases by 1 1 . Similarly, we observe that any number X X with x x consecutive 9s from the right side of the number will have g ( X ) = g ( X + 1 ) + 9 x 1 g(X) = g(X+1) + 9x -1 . For example the number, g ( 3499 ) = g ( 3500 ) + 9 ( 2 ) 1 = 25 g(3499) = g(3500) + 9(2) -1 = 25 .

Back to the question, we need to find the smallest integer N N such that both N N and N + 1 N+1 are 0 ( m o d 50 ) \equiv 0 \pmod {50} . Hence, g ( N ) g ( N + 1 ) 0 ( m o d 50 ) g(N) \equiv g(N+1) \equiv 0 \pmod{50} . From here, it is clear that 9 x 1 0 ( m o d 50 ) 9x -1 \equiv 0 \pmod{50} and 9 x 1 ( m o d 50 ) 9x \equiv 1 \pmod {50} . We can also arrive at x 4 ( m o d 5 ) x \equiv 4 \pmod {5} .

Note that for N + 1 N+1 to be divisible by 50 50 , the sum of the digits from the left side of N till the whole string of 9 9 s (e.g. in 2499 2499 , the digits referred to are 2 2 and 4 4 ) must be 50 k 1 50k-1 . Since the question is looking for the smallest N N , the smallest digit sum of the numbers before the string of 9 9 s is 50 1 = 49 50 -1 = 49 . From here, we know that g ( N ) = 49 + 9 x = 50 n g(N) = 49 + 9x = 50n , for integer n n .

Trying out x 4 ( m o d 5 ) x \equiv 4 \pmod 5 ---- x = 4 , 9 , 14 , . . . x ={4, 9, 14, ...} , the smallest x x that fulfills the above is 39 39 . Hence, there are 39 39 consecutive 9s from the right side of N N . Since the digits from the left side before the strings of 9 9 s add up to 49 49 , the smallest number formed by these digits with the last digit not equal to 9 9 is 199998 199998 . Therefore, N = 19999899...99 N = 19999899...99 with 39 39 9s behind.

The answer is hence, 39 + 4 = 43 39 +4 = \boxed{43}

P.S. Sorry for the long solution.... I know the annotations of digits on the right and left can be quite confusing. I will try to clarify as follows:

Let the number X X be a b c d 9999 \overline {abcd9999} , where d 9 d \neq 9 . x = 4 x = 4 since there are 4 4 consecutive 9 9 s from the right side of the number. g ( X ) g(X) here = a + b + c + d + 9 + 9 + 9 + 9 = a+b+c+d+9+9+9+9 . The digits from the left side of X till the whole string of 9 9 s here are a , b , c and d a,b,c \text{ and } d .

Ugh I guessed 39,41,42

Daniel Wang - 7 years, 5 months ago

number begins with a 5 not 1 check your solution

arb it - 7 years, 5 months ago

Log in to reply

Yes! You are right! Sorry typo mistake... since 5 + 9 + 9 + 9 + 9 + 8 = 49 5+9+9+9+9+8=49

Happy Melodies - 7 years, 5 months ago
Eddie The Head
Jan 28, 2014

Clearly the last few digits of the number must be 9 because otherwise when we take the sum of all the digits of the number we will end up with 2 consecutive numbers both of which cannot be divisible by 50....so the general form of a permissible number will be p(say) 9's at the end and some number at the front of the 9's which adds to a multiple of 50 - 1(of the form 50k-1)... So if we add 1 to this number we will have all the 9's converted to zeroes and the carry over being added to the number in front which will cause the digital sum to be 50k -1 + 1 = 50k(a multiple of 50)...so N+1 = 50k.....Now we consider N which ids of the form 50k - 1 + 9p and this should be divisible by 50...ie ...50 divided 9k - 1....Taking modulo 50 we see that this is only possible if k = 39...... So we must have 39 9's at the end...... Now to minimize the number in the front it's last digit(placed before the 9's mus be 8....(To minimize N it's digital sum must be 49)...So it's remaining digits must add up to 49-8 = 41.. And the lowest number with this property is 499998......So the total number of 9's will be 39+4=43.

Alexander Xue
Dec 22, 2013

Let the digit sum of N be s s , and the number of 9s at the right of the number N be x x . For example, x x for 99 would be 2 while x x for 909 would be 1. Observe that the digit sum of N+1 is s 9 x + 1 s - 9x + 1 . This is because adding 1 to N will result in carry-overs for all the 9s at the right of the number N, and will add 1 to the first digit to the left of all the 9s, making the digit sum increase by 1. Additionally, all the 9s will become 0, making the digit sum decrease by 9 times the original number of 9s at the right of N. Thus, s 9 x + 1 s-9x+1 is the digit sum of N+1

Then 50 s 50 | s and 50 s 9 x + 1 50 | s-9x+1 so 50 divides their difference, or 50 9 x 1 50 | 9x-1 . Thus, 9 x 1 ( m o d 50 ) 9x \equiv 1 \pmod {50} . Since the inverse of 9 modulo 50 is 39 (can be calculated by the Euclidean Algorithm [see end] or noticing that 801=9*89, so 39), we have that x 39 ( m o d 50 ) x \equiv 39 \pmod {50} . Thus, there are 39 9's at the right of N.

Since 50 s 50 | s , N will have 39 9's at the right and more digits, that sum to 49 (to obtain the smallest possible N with a digit sum divisible by 50) because the 39 9's sum to 1 mod 50. In order to obtain the smallest possible N, there first needs to be the smallest possible number of digits that sum to 49. This can be found by maximizing the number of 9s for the digits. The smallest possible number of digits is then clearly 6 (9*5+4=49).

Just maximizing the number of 9's doesn't minimize N to satisfy the conditions. The conditions for N are that the digit to the left of all the 9's at the end can't be 9 and that the first digit must be minimized. Well, since we have that 9 5 + 4 = 49 9*5+4=49 , having a 4 as the first digit won't work because then we would have x = 40 x=40 . But 5 works. Indeed, 599998 599998 satisfies the conditions. Checking, it does have 6 digits, so this is for the minimum N. The answer is 39 + 4 = 43 39+4= \boxed{43} .

*Using the Euclidean Algorithm can be done as follows: 50 = 5 9 + 5 9 = 1 5 + 4 5 = 1 4 + 1 4 = 4 1 + 0 50=5*9+5 \\ 9=1*5+4 \\ 5=1*4+1 \\ 4=4*1 + 0

5 = 50 9 5 4 = 9 1 5 1 = 5 1 4 5=50-9*5 \\ 4=9-1*5 \\ 1=5-1*4

1 = 5 1 4 1 = 5 1 ( 9 1 5 ) 1 = 2 5 1 9 1 = 2 ( 50 9 5 ) 1 9 1 = 2 50 11 9 1=5-1*4 \\ 1=5-1*(9-1*5) \\ 1=2*5-1*9 \\ 1=2*(50-9*5)-1*9 \\ 1=2*50-11*9

Thus 1 11 9 ( m o d 50 ) 39 9 1 ( m o d 50 ) 1 \equiv -11*9 \pmod {50} \implies 39*9 \equiv 1 \pmod {50} .

Karlo de Leon
Dec 22, 2013

Let d ( k ) d(k) be the digit sum of k k .

Since there are no a a such that both a a and a + 1 a+1 are divisible by 50, there must be a certain number of 9's in the digits of N N that convert to 0 in N + 1 N+1 . Therefore, d ( N ) > d ( N + 1 ) d(N)>d(N+1) . Let d ( N + 1 ) = 50 d(N+1)=50 being the smallest possible digit sum divisible by 50. Thus, we have the equations

d ( N ) = x + 9 y = 50 + z , d(N)=x+9y=50+z,

d ( N + 1 ) = x + 1 = 50 d(N+1)=x+1=50

where x x is the digit sum of digits in N N that do not convert to 0 in N + 1 N+1 , y y is the number of 9's in the digits of N N that convert to 0 in N + 1 N+1 , and z z is the minimum difference of d ( N ) d(N) and d ( N + 1 ) d(N+1) such that z z is a multiple of 50 and yields an integer solution for y y . Solving yields the answer x = 49 , y = 39 , z = 350 x=49, y=39, z=350 . To have the smallest possible N N , the other digits in N N (with digit sum 49) must be distributed in such a way that each place is maximized (to the digit 9) except for the place that is adjacent to the 9's that convert (in order to halt the conversion) in which the maximum digit that can be placed is 8. Thus, the digits in N N that do not convert to 0 in N + 1 N+1 are 5, 8, and 4 9's. Therefore, there are 39 + 4 = 43 39+4=43 9's in the digits of N N .

Vighnesh Raut
Dec 19, 2013

Separate N into 2 parts as follows: First k digits (dᵢ = digit, with i = 1 to k), followed by r consecutive 9's

N = d₁ d₂ ... dk 9...99 (where dk ≠ 9, and number of consecutive 9's = r) N+1 = d₁ d₂ ... (dk+1) 0...00 (where number of 0's = r)

Digit sum of N = d₁ + d₂ + ... + dk + 9r ---> divisible by 50 Digit sum of N+1 = d₁ + d₂ + ... + dk + 1 ------> divisible by 50

Since both these sums are divisible by 50, their difference is also divisible by 50 9r−1 is divisible by 50 The smallest value of r will be 39 ---> 9*39−1 = 350 ----> divisible by 50

Since digit sum of N+1 (d₁ + d₂ + ... + dk + 1) is divisible by 50, then the smallest possible value of N+1 (and therefore smallest possible value of N) occurs when d₁ + d₂ + ... + dk = 49 (and where dk ≠ 9). Also to make first part of N (d₁ d₂ ... dk) as small as possible, make each digit from right to left as large as possible. This will minimize the number of digits, and make d₁ as small as possible.

d₁ d₂ ... dk = 599998 (remember dk cannot be 9) N = 599998 followed by 39 consecutive 9's

N = 599 998 999 999 999 999 999 999 999 999 999 999 999 999 999 N+1 = 599 999 000 000 000 000 000 000 000 000 000 000 000 000 000

Digit sum of N = 5+9+9+9+9+8+39*9 = 400 Digit sum of N+1 = 5+9+9+9+9+9 = 50

N has 39 consecutive 9's 43 total 9's 45 total digits

Pranshu Gaba
Dec 17, 2013

I will be denoting the digit sum of positive integer x x as S ( x ) S(x) .

It is given that S ( N ) S ( N + 1 ) 0 S(N) \equiv S(N + 1) \equiv 0 ( mod 50 ) (\textrm{mod}\ 50) . That is, both S ( N ) S(N) and S ( N + 1 ) S(N+1) are divisible by 50 50 .

This is only possible when S ( N ) S ( N + 1 ) 0 S(N) - S(N+1) \equiv 0 ( mod 50 ) (\textrm{mod}\ 50) . The difference must also be a multiple of 50 50 . Since the difference cannot be zero, it must be atleast 50 50 or more.

To get such a huge difference in digits sum just by adding 1 1 to N N , N N must end with a lot of 9 9 's.

Let N N end with p p number of nines. There can be digits a 1 a_{1} to a n a_{n} before the nines. Note: a n 9 a_{n} \neq 9 .

Then, the number N N can be shown as:

N = a 1 a 2 a 3 a 4 a n 1 a n n digits 9999 999 p 9’s N = \underbrace{a_{1}a_{2} a_{3}a_{4} \ldots a_{n-1} a_{n}}_\text{n digits} \underbrace{9999\ldots 999}_\text{p 9's}

Let a 1 + a 2 + a 3 + + a n = t a_{1} + a_{2} + a_{3} + \ldots + a_{n} = t

Then, l S ( N ) = t + 9 p \phantom{l} S(N) = t + 9p


Similarly, N + 1 N + 1 can be shown as:

N + 1 = a 1 a 2 a 3 a 4 a n 1 ( a n + 1 ) n digits 0000 000 p 0’s N + 1 = \underbrace{a_{1}a_{2} a_{3}a_{4} \ldots a_{n-1} (a_{n}+1)}_\text{n digits} \underbrace{0000\ldots 000}_\text{p 0's}

Now, S ( N + 1 ) = t + 1 S(N + 1) = t + 1


Since l S ( N ) S ( N + 1 ) ( mod 50 ) \phantom{l} S(N) \equiv S(N + 1) (\textrm{mod}\ 50) ,

t + 9 p t + 1 t + 9p \equiv t + 1 ( mod 50 ) (\textrm{mod}\ 50) ,

9 p 1 9p \equiv 1 ( mod 50 ) (\textrm{mod}\ 50) ,

9 p 9p must be of the form 50 k + 1 50k + 1 , a b c d \phantom{abcd} where k Z k \in \mathbb{Z} .

Since we want N N to be as small as possible, 9 p 9p must also be as small as possible.

Since p p is an integer, 9 9 p 9 \vert 9p . The smallest possible value of 9 p 9p of the form 50 k + 1 50k + 1 can be found as 351 351 .

Therefore p = 39 p = 39 .


So, now we know :

N = a 1 a 2 a 3 a 4 a n 1 a n n digits 9999 999 39 9’s N = \underbrace{a_{1}a_{2} a_{3}a_{4} \ldots a_{n-1} a_{n}}_\text{n digits} \underbrace{9999\ldots 999}_\text{39 9's}

We also want to minimize t t because, again, we want N N to be small.

t + 1 0 t + 1 \equiv 0 ( mod 50 ) (\textrm{mod}\ 50)

t 49 t \equiv 49 ( mod 50 ) (\textrm{mod}\ 50)

Since t t is a sum of positive integers, t t has to be positive. The minimum value of t t satisfying the above condition is 49 49 itself.

So, a 1 + a 2 + + a n = 49 a_{1} + a_{2} + \ldots + a_{n} = 49 .

To minimize the N N , first we must minimize value of n n , increasing the number of digits in N N will increase value of N N . This can be done by making most of the digits from a 1 t o a n a_{1} to a_{n} equal to 9 9 .

Secondly, the first digit ( a 1 ) (a_{1}) must be minimized.

We also have the condition that a n 9 a_{n} \neq 9 . To reduce value of N N we must place larger digits in places with lesser values. Since a n a_{n} cannot be 9 9 , we will make it 8 8 .

Now we get a 1 + a 2 + + a n 1 + 8 = 49 a_{1} + a_{2} + \ldots + a_{n-1} + 8= 49 .

a 1 + a 2 + + a n 1 = 41 a_{1} + a_{2} + \ldots + a_{n-1} = 41

We will now replace a n 1 , a n 2 a_{n-1}, a_{n-2} and so on with 9 9 until we reach 36 36 , which is the largest multiple of 9 9 less than 41 41 .

a n 1 = a n 2 = a n 3 = a n 4 = 9 a_{n-1} = a_{n-2} = a_{n-3} = a_{n-4} = 9 ,

a n 5 = a 1 = 41 36 = 5 a_{n-5} = a_{1} = 41 - 36 = 5 ,

So, finally, we get the minimum value of N N as:

N = 599998 9999 999 39 9’s N = 599998 \underbrace{9999\ldots 999}_\text{39 9's}

The sum of digits of N N is 5 + 36 + 8 + 351 = 400 5 + 36 + 8 + 351 = 400 , which is divisible by 50 50 .

The sum of digits of N + 1 N + 1 is 5 + 36 + 9 = 50 5 + 36 + 9 = 50 , which is also divisible by 50 50 .

This is the minimum such N N possible.

The number of 9 9 's in N N are 4 + 39 = 43 4 + 39 = \boxed{43} , which was what we wanted.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...