Find the smallest number p such that p, p+2, p+6, p+8, p+30, p+32, p+36, and p+38 are all prime.
10 while Found=0
20 P=nxtprm(P)
30 if P+2=prmdiv(P+2) then
40 :if P+6=prmdiv(P+6) then
50 :if P+8=prmdiv(P+8) then
60 :if P+30=prmdiv(P+30) then
70 :if P+32=prmdiv(P+32) then
80 :if P+36=prmdiv(P+36) then
90 :if P+38=prmdiv(P+38) then
100 :print P;P+2;P+6;P+8;P+30;P+32;P+36;P+38
110 :Found=1
120 wend
finds
1006301 1006303 1006307 1006309 1006331 1006333 1006337 1006339
so the number p is 1,006,301. The other numbers are the primes that qualify p as the answer.
|
Posted by Charlie
on 2012-08-19 15:52:08 |