Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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

by hdb (Monsignor)
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"; } } }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040444]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (1)
As of 2018-01-23 08:12 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (241 votes). Check out past polls.