login
Primes p such that a + b is prime and a^2 + b^2 = p^2 and p = c + d such that c^2 + d^2 = e^2.
1

%I #33 May 01 2019 09:13:50

%S 17,73,97,113,137,193,233,313,337,401,449,457,521,569,641,673,809,929,

%T 977,1009,1049,1129,1153,1201,1217,1249,1289,1297,1361,1409,1481,1609,

%U 1697,1873,1889,1913,2017,2137,2153,2273,2281,2377,2393,2417,2441,2521,2969,3001

%N Primes p such that a + b is prime and a^2 + b^2 = p^2 and p = c + d such that c^2 + d^2 = e^2.

%C a^2 + b^2 = p^2 is a primitive Pythagorean triple since the hypotenuse is prime.

%C c^2 + d^2 = e^2 also appears to be a primitive Pythagorean triple.

%e 17 is a term because 15 + 8 = 23 and 15^2 + 8^2 = 17^2 and 17 = 5 + 12 and 5^2 + 12^2 = 13^2.

%o (PARI) isok2(p) = {for (k=1, p-1, if (issquare(zz=k^2+(p-k)^2), return (zz););); return(0);}

%o isok1(p) = {forprime (pp=2, 2*p, for (i=1, pp-1, if (issquare(z=i^2+(pp-i)^2) && (p==sqrtint(z)) && (zz=isok2(p)), return (1);););); return(0);}

%o isok(p) = isprime(p) && isok1(p); \\ _Michel Marcus_, Apr 26 2019

%o (PARI) \\ uses isok2 from above but much quicker version

%o is(n)=if(n%4 != 1 || !isprime(n), return(0)); my(v=thue(T, n^2)); for(i=1, #v, if(v[i][1]>0 && v[i][2]>=v[i][1] && isprime(vecsum(v[i])), return(1))); 0; \\ A283391

%o lista(nn) = T=thueinit('x^2+1, 1); forprime(p=2, nn, if (is(p) && isok2(p), print1(p, ", "))); \\ _Michel Marcus_, Apr 27 2019

%Y Subsequence of A002144. Subsequence of A283391.

%K nonn

%O 1,1

%A _Torlach Rush_, Apr 23 2019