Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Sep 08 2022 08:45:12
%S 0,1,2,1,1,2,2,1,1,2,1,2,2,1,1,2,1,2,1,1,2,1,1,2,2,2,1,1,2,2,1,1,2,1,
%T 2,1,2,1,1,2,1,2,1,2,2,1,1,1,1,2,2,1,2,1,2,1,2,1,2,2,1,2,1,1,2,2,1,2,
%U 1,2,2,1,1,2,1,1,2,2,2,2,1,2,1,2,1,1,2,2,2,1,1,1,1,1,1,1,2,2,1,2,1,2,1,2,1
%N Number of Pythagorean triangles having the n-th prime prime(n) as one of their sides.
%C Primitive Pythagorean triples are given parametrically by (M^2 - N^2)^2 + (2MN)^2 = (M^2 + N^2)^2. Odd primes are uniquely representable (ignoring signs) as M^2 - N^2, but only primes of the form 4k + 1 are uniquely representable as M^2 + N^2. Since 2MN is composite for MN > 1, an odd prime can be a side of one or two Pythagorean triangles. Thus, except for a(1) = 0, a(n) is 2 for prime(n) of the form 4k + 1, and 1 otherwise. - _Chris Boyd_, Jan 25 2016
%H Robert Israel, <a href="/A088978/b088978.txt">Table of n, a(n) for n = 1..10000</a>
%p 0, seq((4-ithprime(i) mod 4 + 1)/2, i=2..1000); # _Robert Israel_, Jan 25 2016
%t Table[(4 - Mod[Prime@ n, 4] + 1)/2, {n, 105}] /. _Rational -> 0 (* _Michael De Vlieger_, Jan 26 2016 *)
%o (PARI) a088978(n) = my(p=prime(n)); if(p==2,0,if((p-1)%4==0,2,1))
%o for(i=1,105,print1(a088978(i),", ")) \\ _Chris Boyd_, Jan 25 2016
%o (Magma) [0] cat [(4-NthPrime(n) mod 4+1)/2: n in [2..100]]; // _Vincenzo Librandi_, Jan 26 2016
%Y Cf. A046081.
%K nonn
%O 1,3
%A _Lekraj Beedassy_, Oct 31 2003
%E Corrected and extended by _Ray Chandler_, Nov 01 2003