Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #78 Jan 05 2025 19:51:35
%S 0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,2,1,0,0,1,1,0,0,0,1,
%T 1,0,1,0,1,1,1,0,0,0,1,0,0,0,0,2,1,1,1,0,1,0,0,1,0,1,1,0,0,0,4,0,0,1,
%U 0,1,0,0,1,1,2,0,0,1,0,1,0,1,0,0,4,0,1,0,1,1,1,0,0,0,1,0,1,0,0
%N a(n) is the number of integer-sided right triangles with hypotenuse n.
%C Or number of ways n^2 can be written as the sum of two positive squares: a(5) = 1: 3^2 + 4^2 = 5^2; a(25) = 2: 7^2 + 24^2 = 15^2 + 20^2 = 25^2. - _Alois P. Heinz_, Aug 01 2019
%D A. H. Beiler, Recreations in the Theory of Numbers, New York: Dover, pp. 116-117, 1966.
%H Stanislav Sykora, <a href="/A046080/b046080.txt">Table of n, a(n) for n = 1..20000</a>
%H Ron Knott, <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Pythag/pythag.html">Pythagorean Triples and Online Calculators</a>
%H F. Richman, <a href="http://math.fau.edu/Richman/mla/pythag3s.htm">Pythagorean Triples</a>
%H 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 7.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PythagoreanTriple.html">Pythagorean Triple</a>
%F Let n = 2^e_2 * product_i p_i^f_i * product_j q_j^g_j where p_i == 1 mod 4, q_j == 3 mod 4; then a(n) = (1/2)*(product_i (2*f_i + 1) - 1). - Beiler, corrected
%F 8*a(n) + 4 = A046109(n) for n > 0. - _Ralf Stephan_, Mar 14 2004
%F a(n) = 0 for n in A004144. - _Lekraj Beedassy_, May 14 2004
%F a(A084645(k)) = 1. - _Ruediger Jehn_, Jan 14 2022
%F a(A084646(k)) = 2. - _Ruediger Jehn_, Jan 14 2022
%F a(A084647(k)) = 3. - _Jean-Christophe Hervé_, Dec 01 2013
%F a(A084648(k)) = 4. - _Jean-Christophe Hervé_, Dec 01 2013
%F a(A084649(k)) = 5. - _Jean-Christophe Hervé_, Dec 01 2013
%F a(n) = A063725(n^2) / 2. - _Michael Somos_, Mar 29 2015
%F a(n) = Sum_{k=1..n} Sum_{i=1..k} [i^2 + k^2 = n^2], where [ ] is the Iverson bracket. - _Wesley Ivan Hurt_, Dec 10 2021
%F a(A002144(k)^n) = n. - _Ruediger Jehn_, Jan 14 2022
%p f:= proc(n) local F,t;
%p F:= select(t -> t[1] mod 4 = 1, ifactors(n)[2]);
%p 1/2*(mul(2*t[2]+1, t=F)-1)
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Jul 18 2016
%t a[1] = 0; a[n_] := With[{fi = Select[ FactorInteger[n], Mod[#[[1]], 4] == 1 & ][[All, 2]]}, (Times @@ (2*fi+1)-1)/2]; Table[a[n], {n, 1, 99}] (* _Jean-François Alcover_, Feb 06 2012, after first formula *)
%o (PARI) a(n)={my(m=0,k=n,n2=n*n,k2,l2);
%o while(1,k=k-1;k2=k*k;l2=n2-k2;if(l2>k2,break);if(issquare(l2),m++));return(m)} \\ brute force, _Stanislav Sykora_, Mar 18 2015
%o (PARI) {a(n) = if( n<1, 0, sum(k=1, sqrtint(n^2 \ 2), issquare(n^2 - k^2)))}; /* _Michael Somos_, Mar 29 2015 */
%o (PARI) a(n) = {my(f = factor(n/(2^valuation(n, 2)))); (prod(k=1, #f~, if ((f[k,1] % 4) == 1, 2*f[k,2] + 1, 1)) - 1)/2;} \\ _Michel Marcus_, Mar 08 2016
%o (Python)
%o from math import prod
%o from sympy import factorint
%o def A046080(n): return prod((e<<1)+1 for p,e in factorint(n).items() if p&3==1)>>1 # _Chai Wah Wu_, Sep 06 2022
%Y First differs from A083025 at n=65.
%Y Cf. A000290, A006339, A024362, A046079, A046081, A009000.
%Y A088111 gives records; A088959 gives where records occur.
%Y Cf. A046109, A063725.
%Y Cf. A004144, A084647, A084648, A084649.
%Y Partial sums: A224921.
%K nonn
%O 1,25
%A _Eric W. Weisstein_