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.

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