Given that A is a 5-digit number and that 5 8 A , 5 9 A , 5 2 1 A and 5 3 9 A are all 5-digit numbers with the same 5 digits as A . Find A .
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.
Having an answer from narrowing down / elimination process, is it appropriate for me to post it here when the question is labelled as one of computer science variation? It can be done down to just two.
Although we don't know this, it is likely that the five numbers follow a cyclic number pattern, so we could test this first and hope that we arrive at the answer (which fortunately it does). Being 5 digits, then by the properties of a cyclic number, A = y 5 ⋅ 9 9 9 9 9 for some factor y of 9 9 9 9 9 . Since 9 9 9 9 9 = 3 2 ⋅ 4 1 1 ⋅ 2 7 1 1 , it has ( 2 + 1 ) ( 1 + 1 ) ( 1 + 1 ) = 1 2 possible factors to test ( 1 , 3 , 9 , 4 1 , 1 2 3 , 2 7 1 , 3 6 9 , 8 1 3 , 2 4 3 9 , 1 1 1 1 1 , 3 3 3 3 3 , and 9 9 9 9 9 ), but only y = 4 1 gives an A such that 1 0 0 0 0 ≤ A ≤ 1 2 8 2 0 , and that is A = 1 2 1 9 5 . So while not guaranteed to give the correct answer (or only answer), this does cut down the testing to 1 2 tries.
Log in to reply
Yes, just wanted to try the no assumption of cyclic way of doing this, when I haven't heard of the word long time ago.
One of the first things we notice is that A is always a multiple of 5 and is less than 12821 (to fit the constraint of 39A/5 being a five-digit number). Working along these lines, we can use this Java code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
This is a rather long approach and no doubt there are more efficient algorithms for doing so. In any case, running the code gives us 12195.
Computer screening of all integers from 10000 to 99999
Table [ If [ d = Sort [ IntegerDigits [ a ] ] ; ( 5 8 a ∈ Z ∧ 5 9 a ∈ Z ∧ 5 2 1 a ∈ Z ∧ 5 3 9 a ∈ Z ) ∧ ( 1 0 0 0 0 ≤ 5 8 a ≤ 9 9 9 9 9 ∧ 1 0 0 0 0 ≤ 5 9 a ≤ 9 9 9 9 9 ∧ 1 0 0 0 0 ≤ 5 2 1 a ≤ 9 9 9 9 9 ∧ 1 0 0 0 0 ≤ 5 3 9 a ≤ 9 9 9 9 9 ) ∧ ( d = Sort [ IntegerDigits [ 5 8 a ] ] ∧ d = Sort [ IntegerDigits [ 5 9 a ] ] ∧ d = Sort [ IntegerDigits [ 5 2 1 a ] ] ∧ d = Sort [ IntegerDigits [ 5 3 9 a ] ] ) , a , Nothing ] , { a , 1 0 0 0 0 , 9 9 9 9 9 } ] ⇒ 1 2 1 9 5
Yes, I noticed the multiple of 5 and being less than 12820 phenomena. I did not take advantage of them. The screening for the fractions being integers was necessary so that the IntegerDigits function would not create errors.
A is multiple of 5. Write A/5 as i , i ranges from 10,000//5 to 100,000//39
1 2 3 4 5 6 7 8 |
|
We have five clues, four multiples and the information about the same digits. Since all of them are five digit number, A > 10000 and the largest 39A/5 < 100000, so we have 10000 < A < 12821 AND A is divisible by five. So right away we already know A = 1###0 or A = 1###5, with limited options for the second digit, either 0 or 1 or 2.
One of the clues are 9A/5, so if A have the same digits as that, then A's sum of digits must also be divisible by nine. Also, from A > 10000 and 39A/5 = 7.8A > 78000, then at least one of A's digit MUST include 8 or 9. From 39A/5 < 100000 and clue 21A/5, we get 42000 < 4.2A < 53847, making either 4 or 5 another must have. If A = 1###0, then we'll have a set A = {1, {0, 1, 2}, {{4, 5}, {8, 9}}, {{8, 9}, {4, 5}}, 0}, but no digit combination from this set can get a sum of multiple of nine. This told us that A must be in the form of 1###5.
To complete the number, we have to complement it with three other digits that sums at 12, 11 or 10 (from second digit of 0 or 1 or 2), since we already acknowledged that 8 or 9 must be included. About the four or five, we can relax that condition a bit because we have a five at the end. We can have either 0+8+4, 0+9+3, 1+9+2 or 2+9+1 (basically the same as the third choice). The other options like 1+8+3 and 2+8+2 can be ignored since you cannot have an eight without a four (if 39A/5 < 90000, then 21A/5 < 48462), so it's no use even when we had a five. So now with A = 1###5, and choices of 0+8+4 (2 ways of 10485 or 10845), 0+9+3 (2 ways of 10395 or 10935) and 2+9+1 (2 ways of 11295 or 12195), we can just do the rest. 2+9+1 only have 2 ways because 2 can't be the fourth digit of A, 1##25, as it implies A/5 will end in digit 5, and multiplication by 8 will end it in 0 for 8A/5, which is not included in the set of 2+9+1.
If five errors in six trials seems too much to do, we can look at the last digit of A/5. For 0+8+4, if A ended with 85 (1##85, specifically, A = 10485), then A/5 ended with 7 (simply double the fourth digit and add one). So both 0+8+4 and 0+9+3 would end up with either 7 or 9 for the last digit of A/5, and 2+9+1 with only 9 (why not 5 have already been discussed earlier). Then multiply back to 8, 1 and 9 from 8A/5, 21A/5 and 39A/5 (just take the LD, last digit). Easily seen on a table, but only when LD of A/5 is nine that we can get back the digits within A. 9x8, 9x1 and 9x9 give out LDs of 2, 9 and 1, respectively, nicely confirming the 2+9+1 option. A is now conveniently 1##95, for 1 and 2 to fill in the blanks. You can be wrong twice here, no worries.
Doing it the table way
Let's make assumptions for all 10 digits if it was the last digit (LD) after the division of A/5.
Last Digit (LD) of A/5 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
x5 (from A = 5A/5) | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 5 |
x8 (from 8A/5) | 0 | 8 | 6 | 4 | 2 | 0 | 8 | 6 | 4 | 2 |
x9 (from 9A/5, 39A/5) | 0 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
x1 (from 21A/5) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Then use back all the restrictions we have going on before :
1) 39A/5 < 100000 ==> 10000 < A < 12821
2) A must start with 1 and end with either 0 or 5 (after multiplication with 5).
3) A must contain at least one even digit (after multiplication with 8).
4) 42000 < 21A/5 < 53847
==> A must contain at least either one of 4 or 5.
5) 78000 < 39A/5 < 100000
==> A must contain at least either one of 8 or 9.
6) Sum of all 5 digits within A must be a multiple of 9 (after multiplication with 9).
Now use the first 5 restrictions to review the table. Scratch those that could not abide by at least 4 of them, and sum the total of the four possible digits for all probable cases. Then, input the complementary digit below in a new row (which will total up to a multiple of 9).
Last Digit (LD) of A/5 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
x5 (from A = 5A/5) | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 5 | 0 | 5 |
x8 (from 8A/5) | 0 | 8 | 6 | 4 | 2 | 0 | 8 | 6 | 4 | 2 |
x9 (from 9A/5, 39A/5) | 0 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 |
x1 (from 21A/5) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Yes / No | X | ✓ | X | X | X | X | ? (1) | X | ? (1) | ✓ |
Partial sum | X | 23 | X | X | X | X | 18 | X | 14 | 17 |
Complementary digit(s) | X | 4 | X | X | X | X | 0 or 9 | X | 4 | 1 |
In the end, we get 4 possible permutations of A, which are listed below :
1) { 1, 4, 5, 8, 9 } for LD = 1, or
2) { 0, 4, 6, 8, { 0, 9 } } for LD = 6, or
3) { 0, 2, 4, 8, 4 } for LD = 8, or
4) { 1, 1, 2, 5, 9 } for LD = 9.
Fortunately, possibilities 2) and 3) are not valid without a 1 as A's ten thousands digit. As for possibility 1), the least permutation of the digits is outside of the probable range from our first restriction of 10000 < A < 12821 < 14589.
Now, all that's left to be solved is to find the one true and final permutation of { 1, 1, 2, 5, 9 }. It must be in the form of 1###5 as we proposed earlier, but that would need 3! = 6 trials and 5 maximum errors for blind, random fill-in. We already know that A/5 have a last digit of 9, so we cannot have it in the form of 1##25 else the LD becomes 5 instead. By now, the possibilities have been shrunk down to 11295 or 12195 (from the earlier LD ≠ 5 and 10000 < A < 12821 restriction).
Good luck, even when you don't need it anymore now (with 3 attempts allowed to us and you only need two of those).
First off, 39A/5 < 100000
==> 10000 < A < 12821
Basically, you need
1) 1 in ten thousands
2) either 0 or 5 in ones / digits place
3) either 8 or 9 somewhere in the middle
4) the digit sum to be a multiple of 9
5) at least an even digit
6) 4 or 5 if neither existing for the previous conditions
There are 4 possible scenarios for A/5 :
1) a non-zero even as last digit number
2) a zero as last digit number
3) a five as last digit number
4) a non-five odd as last digit number
For 1), A would end in 0 and the multiples with 8, 9, 21 & 39 would all end in 3 distinct non-zero even numbers, so A would look like this :
1 [E1] [E2] [E3] 0
One of the Es would need to be 8, so our multiple of 9 had to be more than 1 + 8 + 0 = 9, and that is either 18 or 27 though neither is possible considering that the other two has to be distinct non-0, non-8 even digits.
For 2), A would end in 00 or 50 and the multiples with 8, 9, 21 & 39 would all end in zeros too, so A would look like this :
1 [X1] [X2] [0 or 5] 0
One of the Xs would need to be 8 or 9, so our multiple of 9 had to be at least equal to 1 + { 8 , 9 } + { 0 , 5 } + 0 = { 9 , 10 , 14 , 15 }, and that has to be 9 or 18 with only one digit left to be found with possibilities of { 9-9 , 18-9 , 18-10 , 18-14 , 18-15 } = { 0 , 9 , 8 , 4 , 3 } , in which 0 is the only one suitable to be X1 (with A < 12821), but 10800 doesn't fulfill all the conditions (#6 about the inclusion of either 4 or 5).
For 3), A would end in 25 or 75 and the multiples with 8, 9, 21 & 39 would all end in fives & zero (in 8A/5 case) too, so A would look like this :
1 [X1] [X2] [2 or 7] 5
One of the Xs would need to be 8 or 9, so our multiple of 9 had to be at least equal to 1 + { 8 , 9 } + 0 + { 2 , 7 } + 5 = { 16 , 17 , 21 , 22 }, and that has to be exactly 18 or exactly 27 with no digits left to be found. Since none of the 4 possibilities are equal to neither 18 nor 27, then this third possibility is now an impossibility.
For 4), A would end in 5 and the multiples with 8, 9, 21 & 39 would end in two distinct non-five odd digits & non-zero even digit (in 8A/5 case), so A would look like this :
1 [X1] [X2] [X3] 5
with X1, X2 & X3 being 2 odds and an even in some order. Since X1 + X2 + X3 + 1 + 5 = odd + even + odd + 1 + 5 = even, then our multiple of 9 can only be 18 (36 would be too large considering the known digits of 1 & 5 and the parity involved). One of the Xs would need to be 8 or 9, so our multiple of 9 had to be 1 + { 8 , 9 } + 5 = { 14 , 15 }, and that has to be exactly 18 with two digits left to be found. 18-14 = 1 + 3 for a sum of 2 odd digits and 18-15 = 1 + 2 are the only 2 sums involving two non-zero digits. Our number is now down to this possibilities : { 11385 , 11835 , 11295 , 12195 }. Testing each of these last 4 with a multiple will let's us see which one is the answer we're looking for.
Its a brute force, sorry I'm not more clever...
For each 5 digit number i, we compute the 4 accompanying numbers, check that they are all 5 digits long then check that they are composed of the same digits
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
Problem Loading...
Note Loading...
Set Loading...
My approach was brute-force, after narrowing down the options as much as I could.
Obviously 1 0 0 0 0 ≤ A ≤ 9 9 9 9 9 in order to have 5 digits. [90000 possibilities]
Now, we must have A ≤ 1 2 8 2 0 , otherwise 5 3 9 A would have too many digits. [2821 possibilities]
Next, A must be a multiple of 5 , otherwise 5 8 A would not be a whole number. [565 possibilities]
So A = 5 x for some integer x . The numbers in the list are 5 x , 8 x , 9 x , 2 1 x , 3 9 x . Since these are made up of the same digits, they must all have the same remainder when divided by 9 . So 9 must divide the difference of any two of the numbers in the list, in particular 8 x and 9 x . So 9 divides x , and 4 5 divides A [62 possibilities]
There are other restrictions that could be used here, but at this point I reverted to brute force (ie just checking each of the multiples of 4 5 from 1 0 0 3 5 up to 1 2 7 8 0 ), and found just one solution, 1 2 1 9 5 . [1 possibility]
I'd be interested, though: what other restrictions could easily be implemented to narrow down further from the 62 possibilities?