Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: 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?

by Anonymous Monk
on Aug 23, 2008 at 13:40 UTC ( [id://706416]=note: print w/replies, xml ) Need Help??


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
  • Comment on Re: 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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://706416]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found