in reply to Simple Math Puzzle...

D(1,3,4,5) !=0 and D(1,2,4,5) != 9. D5 cannot be 0 (it would be lowest), D5 cannot be higher than 2 because d5(3) + d4(6) => d1(9) but d3 is hi +ghest. d5 must be 1|2, so d4 must be 2|4, so d1 must be > 3, so d3 must be > +4. D2 must be 0|1. Eliminate the impossible Digit 1 2 3 4 5 ----------------- 0 x 0 x x x 1 x 1 x x 1 2 x x x 2 2 3 x x x x x 4 4 x x 4 x 5 5 x 5 x x 6 6 x 6 x x 7 7 x 7 x x 8 8 x 8 x x 9 x x 9 x x Leaves us these choices. 4 0 5 2 1 5 1 6 4 2 6 7 7 8 8 9 d1+1 = d3 means this further reduces to 40521 50621 60721 70821 80921 * 70842 71842 80942 * 81942 *

Eliminating those * that lack two prime digits leaves five+ six answers? (I think!)

(40521, 50621, 60721, 70821, 70842+, 71842)

+ Corrected. Thanks to crenz.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: Simple Math Puzzle...(no code required?)
by crenz (Priest) on May 10, 2003 at 17:49 UTC

    I like the way how you showed to get the correct solutions; however, 70842 should be counted a solution as well -- it has two prime digits (2 and 7).

Re^2: Simple Math Puzzle...(no code required?)
by hdb (Monsignor) on Jun 24, 2013 at 15:05 UTC

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