Determine all possible
primes p such that each of p-8, p-4, p+8 and p+12 are also primes.
The P in the following program is 8 lower than the p of the puzzle, and tests P+4, P+8 (the original p of the puzzle), P+16 and P+20 for primality, and finds only P=3 (puzzle's original p=11) when testing all P through 131,708,999, at which point it was manually interrupted.
list
10 loop
15 Pp=P
20 P=nxtprm(P)
30 if prmdiv(P+4)=P+4 then
40 :if prmdiv(P+8)=P+8 then
50 :if prmdiv(P+16)=P+16 then
60 :if prmdiv(P+20)=P+20 then
70 :print P;P+4;P+8;P+16;P+20
75 if P=0 then goto 100
80 endloop
100 print Pp
OK
asave "5primes"
OK
run
3 7 11 19 23
Break in 20
?p,pp
131709001 131708999
OK
|
Posted by Charlie
on 2007-12-26 11:59:39 |