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.

A020478 Number of singular 2 X 2 matrices over Z(n) (i.e., with determinant = 0).

Original entry on oeis.org

1, 10, 33, 88, 145, 330, 385, 736, 945, 1450, 1441, 2904, 2353, 3850, 4785, 6016, 5185, 9450, 7201, 12760, 12705, 14410, 12673, 24288, 18625, 23530, 26001, 33880, 25201, 47850, 30721, 48640, 47553, 51850, 55825, 83160, 51985, 72010, 77649, 106720
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    f[p_, e_] := p^(2*e - 1)*(p^(e + 1) + p^e - 1); a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 22 2020 *)
  • PARI
    a(n)=if(n<1, 0, direuler(p=2, n, (1-p*X)/((1-p^2*X)*(1-p^3*X)))[n])
    
  • PARI
    a(n)=local(c=0); forvec(x=vector(4,k,[1,n]),c+=((x[1]*x[2]-x[3]*x[4])%n==0)); c

Formula

From Vladeta Jovovic, Apr 22 2002: (Start)
a(n) = n^4 - A005353(n).
Multiplicative with a(p^e) = p^(2*e - 1)*(p^(e+1) + p^e - 1). (End)
Dirichlet g.f.: zeta(s-2)*zeta(s-3)/zeta(s-1).
A102631(n) | a(n). - R. J. Mathar, Mar 30 2011
Sum_{k=1..n} a(k) ~ Pi^2 * n^4 / (24*Zeta(3)). - Vaclav Kotesovec, Jan 31 2019
From Piotr Rysinski, Sep 11 2020: (Start)
a(n) = n * A069097(n).
Proof: a(n) is multiplicative with a(p^e) = p^(2*e - 1)*(p^(e+1) + p^e - 1), A069097(n) is multiplicative with A069097(p^e) = p^(e-1)*(p^e*(p+1)-1), so a(p^e) = p^e*A069097(p^e). (End)

A096018 Number of Pythagorean quadruples mod n; i.e., number of solutions to w^2 + x^2 + y^2 = z^2 mod n.

Original entry on oeis.org

1, 8, 21, 64, 145, 168, 301, 512, 621, 1160, 1221, 1344, 2353, 2408, 3045, 4096, 5185, 4968, 6517, 9280, 6321, 9768, 11661, 10752, 18625, 18824, 16281, 19264, 25201, 24360, 28861, 32768, 25641, 41480, 43645, 39744, 51985, 52136, 49413, 74240
Offset: 1

Views

Author

T. D. Noe, Jun 15 2004

Keywords

Crossrefs

Cf. A062775 (number of solutions to x^2 + y^2 = z^2 mod n), A240547.

Programs

  • Maple
    A096018 := 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^(3*e) ;
            elif modp(p,4) = 1 then
                a := a* p^(2*e-1)*(p^(e+1)+p^e-1) ;
            else
                if type(e,'even') then
                    a := a* (p^(3*e)+(p-1)*p^(2*e-1)*(1-p^e)/(1+p)) ;
                else
                    a := a* (p^(3*e)-(p-1)*p^(2*e-1)*(1+p^e)/(1+p)) ;
                end if;
            end if;
        end do:
        a ;
    end proc:
    seq(A096018(n),n=1..50) ; # R. J. Mathar, Jun 24 2018
  • Mathematica
    Table[cnt=0; Do[If[Mod[w^2+x^2+y^2-z^2, n]==0, cnt++ ], {w, 0, n-1}, {x, 0, n-1}, {y, 0, n-1}, {z, 0, n-1}]; cnt, {n, 50}]
    f[2, e_] := 2^(3*e); f[p_, e_] := If[Mod[p, 4] == 1, p^(2*e - 1)*(p^(e + 1) + p^e - 1), If[EvenQ[e], p^(3*e) + (p - 1)*p^(2*e - 1)*(1 - p^e)/(1 + p), p^(3*e) - (p - 1)*p^(2*e - 1)*(1 + p^e)/(1 + p)]]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 11 2020 *)
  • 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)^3 * M(n, i->-(i^2))), 0)} \\ Andrew Howroyd, Jun 23 2018
    
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, p = f[i, 1]; e = f[i, 2]; if(p == 2, 2^(3*e), if(p%4 == 1, p^(2*e-1)*(p^(e+1) + p^e - 1), if(e%2, p^(3*e) - (p - 1)*p^(2*e - 1)*(1 + p^e)/(1 + p), p^(3*e) + (p - 1)*p^(2*e - 1)*(1 - p^e)/(1 + p)))));} \\ Amiram Eldar, Nov 21 2023

Formula

a(n) is multiplicative. For the powers of primes p, there are several cases. For p=2, we have a(2^e) = 2^(3e). For odd primes p with p==1 (mod 4), we have a(p^e) = p^(2*e-1)*(p^(e+1)+p^e-1). For odd primes p with p==3 (mod 4) and even e we have a(p^e) = p^(3*e) +(p-1)*p^(2*e-1)*(1-p^e)/(1+p). For odd primes p == 3 (mod 4) and odd e we have a(p^e) = p^(3*e) -(p-1)*p^(2*e-1)*(1+p^e)/(1+p). [Corrected Jun 24 2018, R. J. Mathar]
Sum_{k=1..n} a(k) ~ c * n^4 / 4, where c = A334425 * A334426 /(A088539 * A243381) = 0.94532146880744347512... . - Amiram Eldar, Nov 21 2023

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

Original entry on oeis.org

8, 96, 264, 384, 1160, 3168, 3080, 1536, 7560, 13920, 11528, 12672, 18824, 36960, 38280, 6144, 41480, 90720, 57608, 55680, 101640, 138336, 101384, 50688, 149000, 225888, 208008, 147840, 201608, 459360, 245768, 24576, 380424, 497760, 446600, 362880, 415880
Offset: 1

Views

Author

Keywords

Comments

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

Crossrefs

Programs

  • Mathematica
    A[n_] := Sum[If[Mod[a^2 + b^2 + c^2 + d^2, 2n] == n, 1, 0], {d, 0, 2n - 1}, {a, 0, 2n - 1}, {b, 0, 2n - 1}, {c, 0, 2n - 1}];Table[Print[aaa = A[n]]; aaa, {n, 1, 40}]
  • PARI
    a(n)={my(m=2*n); my(p=Mod(sum(i=0, m-1, x^(i^2%m)), x^m-1)^4); polcoeff( lift(p), n)} \\ Andrew Howroyd, Aug 07 2018
    
  • PARI
    a(n)={my(f=factor(n)); 8*prod(i=1, #f~, my([p,e]=f[i,]); if(p==2, 3*2^(2*e), p^(2*e-1)*(p^(e+1)+p^e-1)))} \\ Andrew Howroyd, Aug 07 2018
    
  • Python
    def A229294(n):
        ndict = {}
        n2 = 2*n
        for i in range(n2):
            i3 = pow(i,2,n2)
            for j in range(i+1):
                j3 = pow(j,2,n2)
                m = (i3+j3) % n2
                if m in ndict:
                    if i == j:
                        ndict[m] += 1
                    else:
                        ndict[m] += 2
                else:
                    if i == j:
                        ndict[m] = 1
                    else:
                        ndict[m] = 2
        count = 0
        for i in ndict:
            j = (n-i) % n2
            if j in ndict:
                count += ndict[i]*ndict[j]
        return count # Chai Wah Wu, Jun 07 2017

Formula

a(n) = 8*A240547(n) for odd n, a(2^k) = 24*2^(2*k). - Andrew Howroyd, Aug 07 2018

A316148 Number of non-congruent solutions of x^2+y^2 == z^2+w^2 (mod n).

Original entry on oeis.org

1, 8, 33, 96, 145, 264, 385, 896, 945, 1160, 1441, 3168, 2353, 3080, 4785, 7680, 5185, 7560, 7201, 13920, 12705, 11528, 12673, 29568, 18625, 18824, 26001, 36960, 25201, 38280, 30721, 63488, 47553, 41480, 55825, 90720, 51985, 57608, 77649, 129920, 70561, 101640, 81313
Offset: 1

Views

Author

R. J. Mathar, Jun 25 2018

Keywords

Crossrefs

Programs

  • Maple
    A316148 := 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)*(p^e-1) ;
            else
                a := a*p^(2*e-1)*(p^(e+1)+p^e-1) ;
            end if;
        end do:
        a ;
    end proc:
    seq(A316148(n),n=1..100) ;
  • Mathematica
    f[2, e_] :=  2^(2*e+1)*(2^e-1); f[p_, e_] := p^(3*e)+p^(3*e-1)-p^(2*e-1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 11 2020 *)
  • PARI
    a(n) = {my(f = factor(n), p, e); prod(i = 1, #f~, p = f[i,1]; e = f[i,2]; if(p == 2, 2^(2*e+1)*(2^e-1), p^(3*e)+p^(3*e-1)-p^(2*e-1)));} \\ Amiram Eldar, Dec 18 2023

Formula

Multiplicative with a(2^e) = 2^(2e+1)*(2^e-1), a(p^e) = p^(3e)+p^(3e-1)-p^(2e-1) for odd primes p.
Sum_{k=1..n} a(k) ~ c * n^4 / 4, where c = zeta(2)/zeta(3) = 1.368432... (A306633). - Amiram Eldar, Dec 18 2023
Showing 1-4 of 4 results.