in reply to Puzzle: What is the largest integer whose digits are all different (and do not include 0) that is divisible by each of its individual digits?
I got the 9867312 answer in about 10 minutes, using just thinking and a calculator. Sure, the brain is slower than the PC but probably the overall time to write the program and run it is more than 10 minutes :)
Heuristics:
- the number must have at most 9 digits
- 5,2 mutually exclusive (0 in the end)
- 5,4 mutually exclusive (0 in the end)
- 5,8 mutually exclusive (0 in the end)
=> 5 probably not in
- the remaining are 1 2 3 4 6 7 8 9
- 9 divides a number iff the sum of its digits is divisible by 9, same goes for 3 and 6
- the sum of these digits is 40, so if you take 4 out, it is 36, so we can have a number with 1 2 3 6 7 8 9 divisible by 1 3 6 9 independently of the digits' order
- place 2 last so that the resulting number is divisible by 2
- you want it to be the largest, so first try 9876312
- it won't work, and after a few trials and some luck you get the right answer which is 9867312
|