2012-03-24

Maths Puzzle

Good maths puzzle, this. Using only the digits 1 through 9, no zeroes, no repeats, construct a unique nine digit number using all nine digits such that:-

- The first digit must form a number that is divisible by 1;
- The first and second digits must form a number that is divisible by 2;
- The first three digits must form a number that is divisible by 3;
- The first four digits must form a number that is divisible by 4;
- The first five digits must form a number that is divisible by 5;
- The first six digits must form a number that is divisible by 6;
- The first seven digits must form a number that is divisible by 7;
- The first eight digits must form a number that is divisible by 8;
- All nine digits must form a number that is divisible by 9.

If you can work out the answer before I do, well done.

Some things I have already worked out, to help you along:-

Any number is always divisible by 1. No help there.

Even numbers always end in 2, 4, 6 or 8. That means the digits in positions 2, 4, 6 or 8 can only ever be even, and the digits in the rest of the number in positions 1, 3, 5, 7 and 9 can only ever be odd - 1, 3, 5, 7, 9.

Any number divisible by 3 has to have all of its digits sum up to a single digit sum of 3, 6 or 9. Any number divisible by 6 has to be both even and divisible by 3. The sum of the digits of any number divisible by 9 can only ever be 9. That means that the numbers will always be divisible by 9, no matter what arrangement. So no help for the ninth digit either.

Any number divisible by 4 has to have its last two digits divisible by 4. Eliminating repeating digits, zeroes and combinations where the third digit is 2, 4, 5, 6 or 8 (why 5? You'll see) you are left with the combinations 12, 16, 32, 36, 72, 76, 92 or 96 and your third and fourth digits can only be those.

Why 5? It turns out that only two sets of numbers are exactly divisible by 5. Those that end in a 0, and those that end in a 5. Since there are no zeroes in this puzzle, the digit in position 5 can only, ever, be a 5. No help there? Actually, enormous amounts of help - because that means the digits in positions 1 - 4 and 6 - 9 can never be a 5. Ever.

Digits 1, 3, 7 and 9 can thus only ever be taken from 1, 3, 7 and 9. 5 is taken.

The thing about the digit 7 place is that it happens to be the only 7 digit number divisible by 7 which has a component to the left of it that is divisible by 6. Best I can do for the moment.

And so we come to digit 8, which has to be divisible by 8. Well ...

Just like divisibility by 4, there is a trick you can learn. Numbers divisible by 8 always have their last THREE digits divisible by 8. Now this pattern kind of repeats just like for divisibility by 4. Whereas the four pattern was variations on 04, 08, 12, 16, 20 increasing in units of 20 up to 100, the eight pattern has variations on 08, 16, 24, 32, 40 and increasing in units of 40 up to 200. Now since a number divisible by 8 has to have three digits divisible by 8, you have to check digits in positions 6 and 7 too.

Eliminating repeats, zeroes, use of a 5, and odd numbers in digit 6, the three digits in positions 6, 7, 8 can only ever be 216, 296, 416, 432, 472, 496, 632, 672, 816, 832, 872 or 896.

To summarise:-

Digit Notes

1 Any number is divisible by 1; cannot be 5

2 digit 2 can only be 2, 4, 6 or 8

3 all digits must add up to 3, 6 or 9; cannot be 5

4 digits 3 and 4 can only be 12, 16, 32, 36, 72, 76, 92 or 96

5 digit 5 can only be 5

6 even, all digits must add up to 3

7 divisible by 7; cannot be 5

8 digits 6, 7, 8 can only be 216, 296, 416, 432, 472, 496, 632, 672, 816, 832, 872 or 896

9 all digits add up to 9; cannot be 5

Digits in places 2, 4, 6 and 8 must be even - digits in places 1, 3, 5, 7 and 9 must be odd.

Edit: I've thought about this puzzle, and I think that the number 381654729 fits the bill.

38 is even. 3+8+1 = 12; 1+2 = 3.

3816' last two digits are 16 - 3816 is divisible by 4.

38165 ends in 5 - it is divisible by 5.

381654 is an even number; 3+8+1+6+5+4 = 27; 2+7 = 9.

There is no real divisibility test for 7, so the only real test is to divide 3816547 by 7.

You get 545221.

3816547 is divisible by 7.

And finally, the three digits 472 are in the above list of three-digit numbers divisible by 8, meaning that 38165472 is divisible by 8.

And since 3+8+1+6+5+4+7+2+9 = 45; 4+5 = 9, satisfying the divisibility by 9 requirement.

The number has to be 381654729.

No comments:

Post a Comment

"And if we have unearned luck, now to scape the serpent's tongue, we will make amends ere long. Else the Puck a liar call ..."

So speak.