This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A048161 #74 Apr 25 2025 23:39:07 %S A048161 3,5,11,19,29,59,61,71,79,101,131,139,181,199,271,349,379,409,449,461, %T A048161 521,569,571,631,641,661,739,751,821,881,929,991,1031,1039,1051,1069, %U A048161 1091,1129,1151,1171,1181,1361,1439,1459,1489,1499,1531,1709,1741,1811,1831,1901 %N A048161 Primes p such that q = (p^2 + 1)/2 is also a prime. %C A048161 Primes which are a leg of an integral right triangle whose hypotenuse is also prime. %C A048161 It is conjectured that there are an infinite number of such triangles. %C A048161 The Pythagorean triple {p, (p^2 - 1)/2, (p^2 + 1)/2} corresponds to {a(n), A067755(n), A067756(n)}. - _Lekraj Beedassy_, Oct 27 2003 %C A048161 There is no Pythagorean triangle all of whose sides are prime numbers. Still there are Pythagorean triangles of which the hypotenuse and one side are prime numbers, for example, the triangles (3,4,5), (11,60,61), (19,180,181), (61,1860,1861), (71,2520,2521), (79,3120,3121). [Sierpiński] %C A048161 We can always write p=(Y+1)^2-Y^2, with Y=(p-1)/2, therefore q=(Y+1)^2+Y^2. - _Vincenzo Librandi_, Nov 19 2010 %C A048161 p^2 and p^2+1 are semiprimes; p^2 are squares in A070552 Numbers n such that n and n+1 are products of two primes. - _Zak Seidov_, Mar 21 2011 %D A048161 Wacław Sierpiński, Pythagorean triangles, Dover Publications, Inc., Mineola, NY, 2003, p. 6. MR2002669 %H A048161 T. D. Noe, <a href="/A048161/b048161.txt">Table of n, a(n) for n = 1..10000</a> %H A048161 H. Dubner and T. Forbes, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL4/DUBNER/pyth.html">Prime Pythagorean triangles</a>, Journal of Integer Sequences, Vol. 4(2001), #01.2.3. %F A048161 A000035(a(n))*A010051(a(n))*A010051((a(n)^2+1)/2) = 1. - _Reinhard Zumkeller_, Aug 26 2012 %e A048161 For p=11, (p^2+1)/2=61; p=61, (p^2+1)/2=1861. %e A048161 For p(1)=3, the right triangle 3, 4, 5 is the smallest where 5=(3*3+1)/2. %e A048161 For p(10)=101, the right triangle is 101, 5100, 5101 where 5101=(101*101+1)/2. %p A048161 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 %t A048161 Select[Prime[Range[200]], PrimeQ[(#^2 + 1)/2] &] (* _Stefan Steinerberger_, Apr 07 2006 *) %t A048161 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 *) %o A048161 (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 */ %o A048161 (Haskell) %o A048161 a048161 n = a048161_list !! (n-1) %o A048161 a048161_list = [p | p <- a065091_list, a010051 ((p^2 + 1) `div` 2) == 1] %o A048161 -- _Reinhard Zumkeller_, Aug 26 2012 %o A048161 (Magma) [p: p in PrimesInInterval(3, 2000) | IsPrime((p^2+1) div 2)]; // _Vincenzo Librandi_, Dec 31 2013 %o A048161 (Python) %o A048161 from sympy import isprime, nextprime; p = 2 %o A048161 while p < 1901: p = nextprime(p); print(p, end = ', ') if isprime((p*p+1)//2) else None # _Ya-Ping Lu_, Apr 24 2025 %Y A048161 Cf. A067755, A067756. Complement in primes of A094516. %Y A048161 Cf. A017281, A154428, A010051, A065091, A005383. %Y A048161 Cf. A048270, A048295, A308635, A308636. Primes contained in A002731. %K A048161 nonn,easy,nice %O A048161 1,1 %A A048161 Harvey Dubner (harvey(AT)dubner.com) %E A048161 More terms from _David W. Wilson_