A048161 Primes p such that q = (p^2 + 1)/2 is also a prime.
3, 5, 11, 19, 29, 59, 61, 71, 79, 101, 131, 139, 181, 199, 271, 349, 379, 409, 449, 461, 521, 569, 571, 631, 641, 661, 739, 751, 821, 881, 929, 991, 1031, 1039, 1051, 1069, 1091, 1129, 1151, 1171, 1181, 1361, 1439, 1459, 1489, 1499, 1531, 1709, 1741, 1811, 1831, 1901
Offset: 1
Examples
For p=11, (p^2+1)/2=61; p=61, (p^2+1)/2=1861. For p(1)=3, the right triangle 3, 4, 5 is the smallest where 5=(3*3+1)/2. For p(10)=101, the right triangle is 101, 5100, 5101 where 5101=(101*101+1)/2.
References
- Wacław Sierpiński, Pythagorean triangles, Dover Publications, Inc., Mineola, NY, 2003, p. 6. MR2002669
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
- H. Dubner and T. Forbes, Prime Pythagorean triangles, Journal of Integer Sequences, Vol. 4(2001), #01.2.3.
Crossrefs
Programs
-
Haskell
a048161 n = a048161_list !! (n-1) a048161_list = [p | p <- a065091_list, a010051 ((p^2 + 1) `div` 2) == 1] -- Reinhard Zumkeller, Aug 26 2012
-
Magma
[p: p in PrimesInInterval(3, 2000) | IsPrime((p^2+1) div 2)]; // Vincenzo Librandi, Dec 31 2013
-
Maple
a := proc (n) if isprime(n) = true and type((1/2)*n^2+1/2, integer) = true and isprime((1/2)*n^2+1/2) = true then n else end if end proc: seq(a(n), n = 1 .. 2000) # Emeric Deutsch, Jan 18 2009
-
Mathematica
Select[Prime[Range[200]], PrimeQ[(#^2 + 1)/2] &] (* Stefan Steinerberger, Apr 07 2006 *) a[ n_] := Module[{p}, If[ n < 1, 0, p = a[n - 1]; While[ (p = NextPrime[p]) > 0, If[ PrimeQ[(p*p + 1)/2], Break[]]]; p]]; (* Michael Somos, Nov 24 2018 *)
-
PARI
{a(n) = my(p); if( n<1, 0, p = a(n-1) + (n==1); while(p = nextprime(p+2), if( isprime((p*p+1)/2), break)); p)}; /* Michael Somos, Mar 03 2004 */
-
Python
from sympy import isprime, nextprime; p = 2 while p < 1901: p = nextprime(p); print(p, end = ', ') if isprime((p*p+1)//2) else None # Ya-Ping Lu, Apr 24 2025
Formula
Extensions
More terms from David W. Wilson
Comments