Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Simple Math Puzzle...(no code required?)

by hdb (Prior)
on Jun 24, 2013 at 15:05 UTC ( #1040444=note: print w/ replies, xml ) Need Help??


in reply to Re: Simple Math Puzzle...(no code required?)
in thread Simple Math Puzzle...

The "two primes condition" follows from the fact that columns 4 and 5 have at most one prime, columns 2 has no prime, so there must be at least one prime in columns 1 and 3. But if digit 1 is 8, then digit 3 is 9, so no prime. This will directly create all solutions w/o any test, based on the implied order and your logic above:

use strict; use warnings; for my $two (0..1) { for my $five (($two+1)..2) { for my $one ((3*$five+1)..7) { print "$one$two".($one+1).(2*$five)."$five\n"; } } }


Comment on Re^2: Simple Math Puzzle...(no code required?)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2015-07-07 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (89 votes), past polls