Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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"; } } }

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 perusing the Monastery: (3)
As of 2016-10-22 00:05 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (291 votes). Check out past polls.