Determine all possible triplet(s) (P, Q, R) of nonnegative integers, with P ≥ Q, such that each of P2 + 1 and Q2 + 1 is a prime, and: (P2 + 1)(Q2 + 1) = (R2 + 1).
10 for T=1 to 10000
20 for Q=1 to int(T/2)
30 P=T-Q
40 Q1=Q*Q+1:P1=P*P+1
50 if prmdiv(Q1)=Q1 then
70 :if prmdiv(P1)=P1 then
80 :R=int(sqrt(P1*Q1-1)+0.5)
90 :if R*R+1=P1*Q1 then
100 :print P;Q;R
110 next
120 next
Tests all P and Q whose sum is 10,000 or less and finds only (2, 1, 3)
|
Posted by Charlie
on 2009-08-16 16:50:32 |