Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2016-05-27 01:50 GMT
Find Nodes?
    Voting Booth?