OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
László Tóth, Counting solutions of quadratic congruences in several variables revisited, arXiv preprint arXiv:1404.4214 [math.NT], 2014.
László Tóth, Counting Solutions of Quadratic Congruences in Several Variables Revisited, Journal of Integer Sequences, 17 (2014), Article 14.11.6.
FORMULA
a(n) = n^2 * (3/2 if 4|n) * Product_{primes p == 1 mod 4 dividing n} (1+1/p) * Product_{primes p == 3 mod 4 dividing n} (1-1/p). - Bjorn Poonen, Dec 09 2003
Sum_{k=1..n} a(k) ~ c * n^3 + O(n^2 * log(n)), where c = 36*G/Pi^4 = 0.338518..., where G is Catalan's constant (A006752) (Tóth, 2014). - Amiram Eldar, Oct 18 2022
MATHEMATICA
Table[With[{f = FactorInteger[n][[All, 1]]}, Apply[Times, Map[1 + 1/# &, Select[f, Mod[#, 4] == 1 &]]] Apply[Times, Map[1 - 1/# &, Select[f, Mod[#, 4] == 3 &]]] (1 + Boole[Divisible[n, 4]]/2) n^2] - Boole[n == 1], {n, 50}] (* Michael De Vlieger, Feb 15 2018 *)
PROG
(PARI) a(n) = {my(f=factor(n)); if ((n % 4), 1, 3/2)*n^2*prod(k=1, #f~, p = f[k, 1]; m = p % 4; if (m==1, 1+1/p, if (m==3, 1-1/p, 1))); } \\ Michel Marcus, Feb 14 2018
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003
EXTENSIONS
More terms from David Wasserman, Jun 17 2005
STATUS
approved