A024362 Number of primitive Pythagorean triangles with hypotenuse n.
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
Offset: 1
Keywords
References
- A. H. Beiler, Recreations in the Theory of Numbers. New York: Dover, pp. 116-117, 1966.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Ron Knott, Pythagorean Triples and Online Calculators
- Eric Weisstein's World of Mathematics, Pythagorean Triple
Crossrefs
Programs
-
Haskell
a024362 n = sum [a010052 y | x <- takeWhile (< nn) $ tail a000290_list, let y = nn - x, y <= x, gcd x y == 1] where nn = n ^ 2 -- Reinhard Zumkeller, Dec 02 2012
-
Maple
f:= proc(n) local F; F:= numtheory:-factorset(n); if map(t -> t mod 4, F) <> {1} then return 0 fi; 2^(nops(F)-1) end proc: seq(f(n),n=1..100); # Robert Israel, Jan 11 2016
-
Mathematica
Table[a0=IntegerExponent[n,2]; If[n==1 || a0>0, cnt=0, m=n/2^a0; p=Transpose[FactorInteger[m]][[1]]; c=Count[p, _?(Mod[#,4]==1 &)]; If[c==Length[p], cnt=2^(c-1), 0]]; cnt, {n,100}] a[n_] := If[n==1||EvenQ[n]||Length[Select[FactorInteger[n], Mod[#[[1]], 4]==3 &]] >0, 0, 2^(Length[FactorInteger[n]]-1)]; Array[a, 100] (* Frank M Jackson, Jan 28 2018 *)
-
PARI
a(n)={my(m=0,k=n,n2=n*n,k2,l2); while(1,k=k-1;k2=k*k;l2=n2-k2;if(l2>k2,break);if(issquare(l2),if(gcd(n,k)==1,m++))); return(m);} \\ Stanislav Sykora, Mar 23 2015
Formula
a(n) = [q^n] T(q), n >= 1, where T(q) = Sum_{r>=1,s>=1} rpr(2*r-1, 2*s)*q^c(r,s), with rpr(k,l) = 1 if gcd(k,l) = 1, otherwise 0, and c(r,s) = (2*r-1)^2 + (2s)^2. - Wolfdieter Lang, Jan 10 2016
If all prime factors of n are in A002144 then a(n) = 2^(A001221(n)-1), otherwise a(n) = 0. - Robert Israel, Jan 11 2016
a(4*n+1) = A106594(n), other terms are 0. - Andrey Zabolotskiy, Jan 21 2022
Comments