login
A088978
Number of Pythagorean triangles having the n-th prime prime(n) as one of their sides.
2
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, 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, 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
OFFSET
1,3
COMMENTS
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
LINKS
MAPLE
0, seq((4-ithprime(i) mod 4 + 1)/2, i=2..1000); # Robert Israel, Jan 25 2016
MATHEMATICA
Table[(4 - Mod[Prime@ n, 4] + 1)/2, {n, 105}] /. _Rational -> 0 (* Michael De Vlieger, Jan 26 2016 *)
PROG
(PARI) a088978(n) = my(p=prime(n)); if(p==2, 0, if((p-1)%4==0, 2, 1))
for(i=1, 105, print1(a088978(i), ", ")) \\ Chris Boyd, Jan 25 2016
(Magma) [0] cat [(4-NthPrime(n) mod 4+1)/2: n in [2..100]]; // Vincenzo Librandi, Jan 26 2016
CROSSREFS
Cf. A046081.
Sequence in context: A264840 A308188 A046219 * A276948 A160245 A154351
KEYWORD
nonn
AUTHOR
Lekraj Beedassy, Oct 31 2003
EXTENSIONS
Corrected and extended by Ray Chandler, Nov 01 2003
STATUS
approved