login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A256452
Number of integer solutions to n^2 = x^2 + y^2 with x>0, y>=0.
2
1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 1, 1, 1, 5, 3, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 1, 1, 1, 1, 5, 3, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1, 1, 9, 1, 1, 3, 1, 3, 1, 1, 3, 3, 5, 1, 1, 3, 1, 3, 1, 3, 1, 1, 9, 1, 3
OFFSET
1,5
LINKS
FORMULA
Multiplicative with a(p^e) = 2*e + 1 if p == 1 (mod 4), otherwise a(p^e) = 1.
a(n) = 1 + 2*A046080(n) if n>0.
a(n) = A046109(n)/4 for n > 0. - Hugo Pfoertner, Sep 21 2023
a(n) = A002654(n^2). - Ridouane Oudra, Aug 18 2024
MAPLE
a:= n-> add(`if`(d::odd, (-1)^((d-1)/2), 0), d=numtheory[divisors](n^2)): seq(a(n), n=1..100); # Ridouane Oudra, Aug 18 2024
MATHEMATICA
a[ n_] := Sum[ Mod[ Length@Divisors[n^2 - k^2], 2], {k, n}];
a[ n_] := Length @ FindInstance[ n^2 == x^2 + y^2 && x > 0 && y >= 0, {x, y}, Integers, 10^9]; (* Michael Somos, Aug 15 2016 *)
f[p_, e_] := If[Mod[p, 4] == 1, 2*e + 1, 1]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 12 2020 *)
PROG
(PARI) {a(n) = sum(k=1, n, issquare(n^2 - k^2))};
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Michael Somos, Mar 29 2015
STATUS
approved