Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 thundergnat (Deacon)
on Oct 27, 2005 at 19:48 UTC ( [id://503455]=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?

Arggh, I went to fix a bug and accidentally deleted the whole post.

No need for modules

use strict; use warnings; my $limit = 987654321; my $magic_num = 9 * 8 * 7; my $max = int ($limit / $magic_num); my $start = $max * $magic_num; for (0..$max - 1){ my $num = $start - $magic_num * $_; next if $num =~ /[05]/; next if $num =~ /(.).*\1/; die "$num\n" }
  • 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?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-19 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found