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.

A087784 Number of solutions to x^2 + y^2 + z^2 = 1 mod n.

Original entry on oeis.org

1, 4, 6, 24, 30, 24, 42, 96, 54, 120, 110, 144, 182, 168, 180, 384, 306, 216, 342, 720, 252, 440, 506, 576, 750, 728, 486, 1008, 870, 720, 930, 1536, 660, 1224, 1260, 1296, 1406, 1368, 1092, 2880, 1722, 1008, 1806, 2640, 1620, 2024, 2162, 2304, 2058, 3000
Offset: 1

Views

Author

Yuval Dekel (dekelyuval(AT)hotmail.com), Oct 06 2003

Keywords

Crossrefs

Programs

  • 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 *)
  • 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

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

Extensions

More terms from David Wasserman, Jun 17 2005