Do there exist three 2-digit primes such that:
- Any two of the three, averaged, produce another prime, and
- The average of all three is prime
(In reply to
Sieve of Eratosthenes (solution) by Penny)
5 dim Pr(25)
10 P=9
20 while P<100
30 P=nxtprm(P)
40 if P<100 then:I=I+1:Pr(I)=P
50 wend:print
60 NumPr=I
200 for I=1 to NumPr-2
210 for J=I+1 to NumPr-1
212 Av1=(Pr(I)+Pr(J))/2
215 if nxtprm(Av1-1)=Av1 then
220 :for K=J+1 to NumPr
222 :Av2=(Pr(I)+Pr(K))/2:Av3=(Pr(J)+Pr(K))/2
225 :if nxtprm(Av2-1)=Av2 and nxtprm(Av3-1)=Av3 then
230 :Av=(Pr(I)+Pr(J)+Pr(K))/3
240 :if Av=int(Av) then
250 :if nxtprm(Av-1)=Av then print Pr(I),Pr(J),Pr(K),Av:endif
255 :endif
257 :endif
260 :next
270 next
280 next
finds
11 47 71 43.0 (the latter being the average)
|
Posted by Charlie
on 2004-10-22 15:40:33 |