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-2 of 2 results.

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

A316985 Number of solutions to x^2 + y^2 - z^2 == 1 (mod n).

Original entry on oeis.org

1, 4, 12, 24, 30, 48, 56, 128, 108, 120, 132, 288, 182, 224, 360, 512, 306, 432, 380, 720, 672, 528, 552, 1536, 750, 728, 972, 1344, 870, 1440, 992, 2048, 1584, 1224, 1680, 2592, 1406, 1520, 2184, 3840, 1722, 2688, 1892, 3168, 3240, 2208, 2256, 6144, 2744, 3000
Offset: 1

Views

Author

Andrew Howroyd, Jul 18 2018

Keywords

Crossrefs

Programs

  • Maple
    g:= proc(t)
       if t[1]=2 then 2^(2*t[2]+1)
       else (t[1]+1)*t[1]^(2*t[2]-1)
       fi
    end proc:
    g([2,1]):= 4: g([2,2]):= 24:
    seq(convert(map(g, ifactors(n)[2]),`*`),n=1..100); # Robert Israel, Jul 20 2018
  • Mathematica
    a[n_] := a[n] = If[PrimeQ[n], n(n+1), Times @@ (Which[#[[1]] == 2 && #[[2]] == 1, 4, #[[1]] == 2 && #[[2]] == 2, 24, #[[1]] == 2, 2^(2 #[[2]]+1), True, (#[[1]]+1) #[[1]]^(2 #[[2]]-1)]& /@ FactorInteger[n])]; a[1] = 1; a[2] = 4; Array[a, 50] (* Jean-François Alcover, Jul 25 2018 and slightly modified by Robert G. Wilson v, Jul 25 2018 *)
  • PARI
    M(n, f)={sum(i=0, n-1, Mod(x^(f(i)%n), x^n-1))}
    a(n)={polcoeff(lift(M(n, i->i^2)^2 * M(n, i->-(i^2)) ), 1%n)}
    
  • PARI
    a(n)={my(f=factor(n)); prod(i=1, #f~, my(p=f[i,1], e=f[i,2]); if(p==2, if(e>2, 2^(2*e+1), if(e==1, 4, 24)), (p+1)*p^(2*e-1)))}

Formula

Multiplicative with a(2^1) = 4, a(2^2) = 24, a(2^e) = 2^(2*e+1) for e > 2, a(p^e) = (p+1)*p^(2*e-1) for odd prime p.
a(n) = n^2*Sum_{d|n} mu(d)^2/d for n odd.
a(n) = A229179(n) for n mod 4 <> 0.
Sum_{k=1..n} a(k) ~ c * n^3, where c = 19/(4*Pi^2) = 0.4812756... . - Amiram Eldar, Oct 18 2022
Showing 1-2 of 2 results.