There is a huge (maybe infinite) number of twin primes, like (11,13), but only one triplet with d=2, i.e. (3,5,7).
However, one can get longer arithmetic series with other values of d.
Please list all the increasing arithmetic series such that:
a. They consist of at least 5 prime members.
b. Each number is under 100.
Example: 5,11,17,23,29. (d=6)
10 ' limit to first 25 primes; 25th = 97
15 Lim=25
20 for Strt=1 to Lim-5
30 for Fin=Strt+5 to Lim
40 P1=prm(Strt):Pn=prm(Fin)
50 Diff=Pn-P1
60 for D=2 to int(Diff/4)
70 if Diff/D=int(Diff/D) then
80 :Good=1
90 :for P=P1+D to Pn-D step D
100 :if prmdiv(P)<>P then Good=0:endif
110 :next P
120 :if Good then
130 :for P=P1 to Pn step D
140 :print P;
150 :next P
160 :print tab(30);D
170 next D
180 next Fin
190 next Strt
series d
5 11 17 23 29 6
5 17 29 41 53 12
|
Posted by Charlie
on 2011-11-17 12:37:18 |