OFFSET
1,1
COMMENTS
All values are divisible by a(1)=8 and the sequence a(n)/8 is multiplicative. - Andrew Howroyd, Aug 07 2018
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = 8*A240547(n) for odd n, a(2^k) = 24*2^(2*k). - Andrew Howroyd, Aug 07 2018
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}]
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
José María Grau Ribas, Sep 22 2013
STATUS
approved