cp's OEIS Frontend

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.

A024362 Number of primitive Pythagorean triangles with hypotenuse n.

This page as a plain text file.
%I A024362 #49 Feb 16 2025 08:32:34
%S A024362 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,
%T A024362 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,
%U A024362 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
%N A024362 Number of primitive Pythagorean triangles with hypotenuse n.
%C A024362 Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives number of times C takes value n.
%C A024362 a(A137409(n)) = 0; a(A008846(n)) > 0; a(A120960(n)) = 1; a(A024409(n)) > 1; a(A159781(n)) = 4. - _Reinhard Zumkeller_, Dec 02 2012
%C A024362 If the formula given below is used one is sure to find all a(n) values for hypotenuses n <= N if the summation indices r and s are cut off at rmax(N) = floor((sqrt(N-4)+1)/2) and smax(N) = floor(sqrt(N-1)/2). a(n) is the number of primitive Pythagorean triples with hypotenuse n modulo catheti exchange. - _Wolfdieter Lang_, Jan 10 2016
%D A024362 A. H. Beiler, Recreations in the Theory of Numbers. New York: Dover, pp. 116-117, 1966.
%H A024362 Reinhard Zumkeller, <a href="/A024362/b024362.txt">Table of n, a(n) for n = 1..10000</a>
%H A024362 Ron Knott, <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Pythag/pythag.html">Pythagorean Triples and Online Calculators</a>
%H A024362 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PythagoreanTriple.html">Pythagorean Triple</a>
%F A024362 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
%F A024362 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
%F A024362 a(4*n+1) = A106594(n), other terms are 0. - _Andrey Zabolotskiy_, Jan 21 2022
%p A024362 f:= proc(n) local F;
%p A024362    F:= numtheory:-factorset(n);
%p A024362    if map(t -> t mod 4, F) <> {1} then return 0 fi;
%p A024362    2^(nops(F)-1)
%p A024362 end proc:
%p A024362 seq(f(n),n=1..100); # _Robert Israel_, Jan 11 2016
%t A024362 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}]
%t A024362 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 *)
%o A024362 (Haskell)
%o A024362 a024362 n = sum [a010052 y | x <- takeWhile (< nn) $ tail a000290_list,
%o A024362                              let y = nn - x, y <= x, gcd x y == 1]
%o A024362             where nn = n ^ 2
%o A024362 -- _Reinhard Zumkeller_, Dec 02 2012
%o A024362 (PARI) a(n)={my(m=0,k=n,n2=n*n,k2,l2);
%o A024362 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
%Y A024362 Cf. A020882, A024361, A046079, A046080.
%Y A024362 Cf. A000290, A010052.
%Y A024362 Cf. A001221, A002144, A106594.
%K A024362 nonn
%O A024362 1,65
%A A024362 _David W. Wilson_