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.

A046081 Number of integer-sided right triangles with n as a hypotenuse or leg.

This page as a plain text file.
%I A046081 #57 Feb 16 2025 08:32:38
%S A046081 0,0,1,1,2,1,1,2,2,2,1,4,2,1,5,3,2,2,1,5,4,1,1,7,4,2,3,4,2,5,1,4,4,2,
%T A046081 5,7,2,1,5,8,2,4,1,4,8,1,1,10,2,4,5,5,2,3,5,7,4,2,1,14,2,1,7,5,8,4,1,
%U A046081 5,4,5,1,12,2,2,9,4,4,5,1,11,4,2,1,13,8,1,5,7,2,8,5,4,4,1,5,13,2,2,7
%N A046081 Number of integer-sided right triangles with n as a hypotenuse or leg.
%C A046081 Pythagorean triples including primitive ones and non-primitive ones. For a certain n, it may be a leg or the hypotenuse in either a primitive Pythagorean triple, or a non-primitive Pythagorean triple, or both. - _Rui Lin_, Nov 02 2019
%D A046081 A. Beiler, Recreations in the Theory of Numbers. New York: Dover, pp. 116-117, 1966.
%H A046081 Lars Blomberg, <a href="/A046081/b046081.txt">Table of n, a(n) for n = 1..10000</a>
%H A046081 Anonymous, <a href="https://web.archive.org/web/20121011232325/http://www.weaver1.btinternet.co.uk/theimmortalwombat/junk/pythag.html">Generator of all Pythagorean triples that include a given number</a> [Internet Archive Wayback Machine]
%H A046081 Ron Knott, <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Pythag/pythag.html">Pythagorean Triples and Online Calculators</a>
%H A046081 F. Richman, <a href="http://math.fau.edu/Richman/mla/pythag3s.htm">Pythagorean Triples</a>
%H A046081 A. Tripathi, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Papers1/46_47-4/Tripathi.pdf">On Pythagorean triples containing a fixed integer</a>, Fib. Q., 46/47 (2008/2009), 331-340. See Theorem 8.
%H A046081 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PythagoreanTriple.html">Pythagorean Triple</a>
%F A046081 a(n) = A046079(n) + A046080(n). - _Lekraj Beedassy_, Dec 01 2003
%F A046081 From _Rui Lin_, Nov 02 2019: (Start)
%F A046081 a(n) = A024363(n) + A328949(n).
%F A046081 a(n) = A024361(n) + A024362(n) + A328708(n) + A328712(n). (End)
%e A046081 From _Rui Lin_, Nov 02 2019: (Start)
%e A046081 n=25 is the least number which meets all of following cases:
%e A046081 1. 25 is a leg of a primitive Pythagorean triple (25,312,313), so A024361(25)=1;
%e A046081 2. 25 is the hypotenuse of a primitive Pythagorean triple (7,24,25), so A024362(25)=1;
%e A046081 3. 25 is a leg of a non-primitive Pythagorean triple (25,60,65), so A328708(25)=1;
%e A046081 4. 25 is the hypotenuse of a non-primitive Pythagorean triple (15,20,25), so A328712(25)=1;
%e A046081 5. Combination 1. and 3. means A046079(25)=2;
%e A046081 6. Combination 2. and 4. means A046080(25)=2;
%e A046081 7. Combination 1. and 2. means A024363(25)=2;
%e A046081 8. Combination 3. and 4. means A328949(25)=2;
%e A046081 9. Combination of 1., 2., 3., and 4. means A046081(25)=4. (End)
%t A046081 a[1] = 0; a[n_] := Module[{f}, f = Select[FactorInteger[n], Mod[#[[1]], 4] == 1&][[All, 2]]; (DivisorSigma[0, If[OddQ[n], n, n/2]^2]-1)/2 + (Times @@ (2*f+1) - 1)/2]; Array[a, 99] (* _Jean-François Alcover_, Jul 19 2017 *)
%o A046081 (PARI) a(n) = {oddn = n/(2^valuation(n, 2)); f = factor(oddn); for (k=1, #f~, if ((f[k,1] % 4) != 1, f[k,2] = 0);); n1 = factorback(f); if (n % 2, (numdiv(n^2)+numdiv(n1^2))/2 -1, (numdiv((n/2)^2)+numdiv(n1^2))/2 -1);} \\ _Michel Marcus_, Mar 07 2016
%o A046081 (Python)
%o A046081 from sympy import factorint
%o A046081 def a(n):
%o A046081     p1, p2 = 1, 1
%o A046081     for i in factorint(n).items():
%o A046081         if i[0] % 4 == 1:
%o A046081             p2 *= i[1] * 2 + 1
%o A046081         p1 *= i[1] * 2 + 1 - (2 if i[0] == 2 else 0)
%o A046081     return (p1 + p2)//2 - 1
%o A046081 print([a(n) for n in range(1, 100)])  # _Oleg Sorokin_, Mar 02 2023
%Y A046081 Cf. A006593, A046079, A046080, A024361, A024362, A024363, A328708, A328712, A328949.
%K A046081 nonn
%O A046081 1,5
%A A046081 _Eric W. Weisstein_
%E A046081 Improved name by _Bernard Schott_, Jan 03 2019