Find the smallest number that is made up of each of the digits 1 through 9 exactly once and is divisible by 99.
The problem is not original.
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.
You write " This can be achieved by swapping 1 and 4, 3 and 6, or 5 and 8." 5 and 8 exchange will keep the number small since they have low values .So the number is 123486759. However changing the places odd to odd or even to even would not effect divisibility by 11. So to have the smallest number, we see that the smaller digits with lover value are to the left since the location to the left has higher value. So 8 and 7, at odd place and 6 and 5 at even places are exchanged.
The number we get is 123475869.
Note: We have to increase digits at odd places by 3 keeping the number to be the smallest.. This can be down in three ways. 1.] by exchanging at three steps starting from right, 2] by exchanging at first by two steps, and then by one step, starting from right, or 3] by exchanging three steps FROM the right RIGHT. The 3] method will produce the smallest number.
Excellent problem!
My Way We need to use Diophantine equation to solve this problem and finally logical thinking is required on the final steps First, we make equations ABCDEFGHI is the number containing all 1 and 9 and distinct each other This number is automatically divisible by 9, so we have to analyse the divisibility of 11
1 1 ∣ A B C D E F G H I ⟹ 1 1 ∣ ( ( A + C + E + G + I ) − ( B + D + F + H ) ) or ( A + C + E + G + I ) − ( B + D + F + H ) = 1 1 k
Suppose A + C + E + G + I = P and B + D + F + H = Q
We know that
P + Q = 4 5 ⟶ P = 4 5 − Q . . . 1
We can also rewrite
( A + C + E + G + I ) − ( B + D + F + H ) = 1 1 k ⟹ P − Q = 1 1 k 2
Substitute 1 → 2 P − Q = 1 1 k ⟹ 4 5 − 2 Q = 1 1 k
⟹ 2 Q + 1 1 k = 4 5 3
by modding both sides by 11, we get 2 Q ≡ 1 ( m o d 1 1 )
2 Q ≡ 1 2 ( m o d 1 1 )
Q ≡ 6 ( m o d 1 1 ) ⟹ Q = 1 1 u + 6 4
Now substitute 4 and 1
P = 4 5 − Q ⟹ P = 4 5 − ( 1 1 u + 6 ) = 4 5 − 1 1 u − 6
P = 3 9 − 1 1 u
Now, we play logic here! since we have P + Q = 4 5
Q = 1 1 u + 6
P = 3 9 − 1 1 u
It is easy to investigate the minimum value of A B C D E F G H I
case 1: u = 0 We get Q = 6 and P = 39
Look:
Q = B + D + F + H
P = A + C + E + G + I
We know the minimum value of Q is 10, since all of those numbers are differed each other and the maximum of Q is 30. We also know that the minimum and the maximum value of P is 15 and 35. This case is impossible since the value Q < 10 and P > 35. Hence, this case are crossed out
case 2: u = 1 We get Q = 17 and P = 28
Look again the case 0 description. This case fulls the condition, 17 is more than 10 but less than 30, and so does the P Now, we play logic
Since this is the smalles number, A must be 1, B must be 2, C must be 3 and D must be 4
After we find the value of A, B, C and D, let's evaluate the remaining P and Q so we can provide E, F, G, H and I
Q = 2 + 4 + F + H = 1 7 ⟹ F + H = 1 1
P = 1 + 3 + E + G + I = 2 8 ⟹ E + G + I = 2 4
We will find F and H first. The possible value for (F, H) is (2, 9) (3, 8) (4, 7) (5, 6) (6, 5) (7, 4) (8, 3) and (9,2). However, 1, 2, 3 and 4 have been used, so the only possible pairs are only (5, 6) and (6, 5). Since F < H, we will take (5, 6) : F = 5 and H = 6
We have found A = 1, B = 2, C = 3, D = 4, F = 5 and H = 6 The rest one for E, G and I are 7, 8 and 9. Since 7 + 8 + 9 = 2 4 , there exist the E, G and I. Since E < G < I, E = 7, G = 8, I = 9
We order the number we've found: A = 1 B = 2 C = 3 D = 4 E = 7 F = 5 G = 8 H = 6 I = 9
We bond them and A B C D E F G H I = 1 2 3 4 7 5 8 6 9
I just wrote a C program to find all permutation and the first permutation which was divisible by 99 was the answer! :P
from itertools import *; S=list(permutations('123456789')); for s in S: if int(''.join(list(s)))%99 == 0: print s; break ;
Problem Loading...
Note Loading...
Set Loading...
The first thing we note is that 1 + 2 + ... + 9 = 45 and as the sum of the digits is divisible by 9 then any arrangement of those digits will produce a number that is divisible by 9. So our challenge reduces to finding the smallest number that is divisible by 11.
To test if a number is divisible by 11 we find a, the sum of digits in the odd positions, and b, the sum of digits in the even positions.
For number 123456789, the first set,1, 3, 5, 7, 9, has sum 25 and the second set, 2, 4, 6, 8, has sum 20. As the difference is 5 we know that the number is not divisible by 11.
However, for the difference to increase from 5 to 11 we need to increase the sum of the first set by 3 and decrease the sum of the second set by 3. This can be achieved by swapping 1 and 4, 3 and 6, or 5 and 8.
Checking the combinations 123475869 is the smallest number divisible by 99.