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.

Showing 1-4 of 4 results.

A062775 Number of Pythagorean triples mod n: total number of solutions to x^2 + y^2 = z^2 mod n.

Original entry on oeis.org

1, 4, 9, 24, 25, 36, 49, 96, 99, 100, 121, 216, 169, 196, 225, 448, 289, 396, 361, 600, 441, 484, 529, 864, 725, 676, 891, 1176, 841, 900, 961, 1792, 1089, 1156, 1225, 2376, 1369, 1444, 1521, 2400, 1681, 1764, 1849, 2904, 2475, 2116, 2209, 4032, 2695, 2900
Offset: 1

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), Jul 18 2001

Keywords

Comments

a(n) is multiplicative and, for a prime p, a(p) = p^2. Hence a(n) = n^2 if n is squarefree.

Crossrefs

Cf. A091143 (number of solutions to x^2 + y^2 = z^2 mod 2^n).
Number of solutions to x^k + y^k = z^k mod n: this sequence (k=2), A063454 (k=3), A288099 (k=4), A288100 (k=5), A288101 (k=6), A288102 (k=7), A288103 (k=8), A288104 (k=9), A288105 (k=10).

Programs

  • Maple
    A062775 := proc(n)
        a := 1;
        for pe in ifactors(n)[2] do
            p := op(1,pe) ;
            e := op(2,pe) ;
            if p = 2 then
                if type(e,'odd') then
                    a := a*p^((3*e+1)/2)*(2^((e+1)/2)-1) ;
                else
                    a := a*p^(3*e/2)*(2^(e/2+1)-1) ;
                end if;
            else
                if type(e,'odd') then
                    a := a*p^((3*e-1)/2)*(p^((e+1)/2)+p^((e-1)/2)-1) ;
                else
                    a := a*p^(3*e/2-1)*(p^(e/2+1)+p^(e/2)-1) ;
                end if;
            end if;
        end do:
        a ;
    end proc:
    seq(A062775(n),n=1..100) ; # R. J. Mathar, Jun 25 2018
  • Mathematica
    Table[cnt=0; Do[If[Mod[x^2+y^2-z^2, n]==0, cnt++ ], {x, 0, n-1}, {y, 0, n-1}, {z, 0, n-1}]; cnt, {n, 50}]
    f[p_, e_] := If[OddQ[e], p^(3*(e+1)/2 - 2)*(p^((e+1)/2) + p^((e-1)/2) - 1), p^(3*e/2 - 1) * (p^(e/2 + 1) + p^(e/2) - 1)]; f[2, e_] := If[OddQ[e], 2^(3*(e+1)/2 - 1)*(2^((e+1)/2) - 1), 2^(3*e/2)*(2^(e/2+1)-1)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 50] (* Amiram Eldar, Oct 18 2022 *)

Formula

a(n) is multiplicative. For the powers of primes p, there are four cases. For p=2, there are cases for even and odd powers: a(2^(2k-1)) = 2^(3k-1) (2^k-1) and a(2^(2k)) = 2^(3k) (2^(k+1)-1). Similarly, for odd primes p, a(p^(2k-1)) = p^(3k-2) (p^k+p^(k-1)-1) and a(p^(2k)) = p^(3k-1) (p^(k+1)+p^k-1). - T. D. Noe, Dec 22 2003
From Gottfried Helms, May 13 2004: (Start)
If the canonical form of n is n = 2^i * 3^j * 5^k *... * p^q, then it appears that a(n) = n * f(2, i) * f(3, j) * f(5, k) * ... * f(p, q), where f(p, 1) = p for any prime p; f(2, i) = 2^i + 2^i - 2^ceiling(i/2); f(p, i) = p^i + p^(i-1) - p^floor((i-1)/2) for any odd prime p.
For example, a(7) = 49 because a(7) = 7*f(7, 1) = 7*7; a(16) = 448 because a(16) = a(2^4) = 16 * f(2, 4) = 16 * (16+16-4) = 16*28 = 448; a(12) = 216 because a(12) = a(3*2^2) = 12*f(2, 2)*f(3, 1) = 12*(4+4-2)*3 = 216. (End)
Sum_{k=1..n} a(k) ~ c * n^3, where c = (16/45) * Product_{p prime} (1 + 1/(p^3 + p^2 + p)) = (16/45)*zeta(3)/zeta(4) = 0.39488943478263044166... . - Amiram Eldar, Oct 18 2022, Nov 30 2023

Extensions

More terms from Sascha Kurz, Mar 25 2002

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

A240547 Number of non-congruent solutions of x^2 + y^2 + z^2 + t^2 == 0 mod n.

Original entry on oeis.org

1, 8, 33, 32, 145, 264, 385, 128, 945, 1160, 1441, 1056, 2353, 3080, 4785, 512, 5185, 7560, 7201, 4640, 12705, 11528, 12673, 4224, 18625, 18824, 26001, 12320, 25201, 38280, 30721, 2048, 47553, 41480, 55825, 30240, 51985, 57608, 77649, 18560, 70561, 101640
Offset: 1

Views

Author

Laszlo Toth, Apr 07 2014

Keywords

Examples

			For n=2 the a(2)=8 solutions are (0,0,0,0), (1,1,0,0), (1,0,1,0), (1,0,0,1), (0,1,1,0), (0,1,0,1), (0,0,1,1), (1,1,1,1).
		

Crossrefs

Programs

  • Maple
    A240547 := proc(n) local a, x, y, z, t ; a := 0 ; for x from 0 to n-1 do for y
    from 0 to n-1 do for z from 0 to n-1 do for t from 0 to n-1 do if
    (x^2+y^2+z^2+t^2) mod n = 0 mod n then a := a+1 ; fi; od; od ; od; od;
    a ; end proc;
    # alternative
    A240547 := proc(n)
        a := 1;
        for pe in ifactors(n)[2] do
            p := op(1,pe) ;
            e := op(2,pe) ;
            if p = 2 then
                a := a*p^(2*e+1) ;
            else
                a := a* p^(2*e-1)*(p^(e+1)+p^e-1) ;
            end if;
        end do:
        a ;
    end proc:
    seq(A240547(n),n=1..100) ; # R. J. Mathar, Jun 25 2018
  • Mathematica
    b[2, e_] := 2^(2 e + 1);
    b[p_, e_] := p^(2 e - 1)*(p^(e + 1) + p^e - 1);
    a[n_] := Times @@ b @@@ FactorInteger[n];
    Array[a, 42] (* Jean-François Alcover, Dec 05 2017 *)
  • PARI
    a(n) = my(m); if( n<1, 0, forvec( v = vector(4, i, [0, n-1]), m += (0 == norml2(v)%n))); m /* Michael Somos, Apr 07 2014 */
    
  • PARI
    a(n) = {my(f = factor(n), res = 1, start = 1, p, e, i); if(n % 2 == 0, res = 1<<(f[1,2]<<1+1); start = 2); for(i = start, #f~, p = f[i, 1]; e = f[i, 2]; res*=(p^(e<<1-1)*(p^(e+1)+p^e-1))); res} \\ David A. Corneth, Jul 22 2018

Formula

Multiplicative, with a(2^e) = 2^(2e+1) for e>=1, a(p^e) = p^(2e-1)*(p^(e+1)+p^e-1) for p > 2, e>=1.
For odd n, a(n) = A069097(n)*n = A020478(n). - R. J. Mathar, Jun 23 2018
Sum_{k=1..n} a(k) ~ c * n^4 + O(n^3 * log(n)), where c = 5*Pi^2/(168*zeta(3)) = 0.244362... (Tóth, 2014). - Amiram Eldar, Oct 18 2022

A229295 Number of solutions to x^2 + y^2 + z^2 == n (mod 2n) for x,y,z in [0, 2*n).

Original entry on oeis.org

4, 24, 36, 32, 100, 216, 196, 192, 396, 600, 484, 288, 676, 1176, 900, 256, 1156, 2376, 1444, 800, 1764, 2904, 2116, 1728, 2900, 4056, 3564, 1568, 3364, 5400, 3844, 1536, 4356, 6936, 4900, 3168, 5476, 8664, 6084, 4800, 6724, 10584, 7396, 3872, 9900, 12696
Offset: 1

Views

Author

Keywords

Comments

All values are divisible by a(1)=4 and the sequence a(n)/4 is multiplicative. - Andrew Howroyd, Aug 07 2018

Crossrefs

Programs

  • Mathematica
    A[n_] := Sum[If[Mod[a^2 + b^2 + c^2, 2*n] == n, 1, 0], {a, 0, 2*n - 1}, {b, 0, 2*n - 1}, {c, 0, 2*n - 1}]; Array[A,100]
  • PARI
    a(n)={my(m=2*n); my(p=Mod(sum(i=0, m-1, x^(i^2%m)), x^m-1)^3); polcoeff( lift(p), n)} \\ Andrew Howroyd, Aug 06 2018
    
  • PARI
    a(n)={my(f=factor(n)); 4*prod(i=1, #f~, my([p, e]=f[i, ]); if(p==2, if(e%2, 3, 1)*2^(e+e\2), p^(e+(e-1)\2)*(p^(e\2)*(p+1) - 1)))} \\ Andrew Howroyd, Aug 07 2018

Formula

a(n) = 4*A087687(n) for odd n, a(4^k) = 4*2^(3*k), a(2*4^k) = 24*2^(3*k). - Andrew Howroyd, Aug 07 2018
Showing 1-4 of 4 results.