OFFSET
1,5
COMMENTS
REFERENCES
J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 102.
Nathan J. Fine, Basic Hypergeometric Series and Applications, Amer. Math. Soc., 1988; p. 78, Eq. (32.26).
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
Michael Somos, Introduction to Ramanujan theta functions.
Eric Weisstein's World of Mathematics, Ramanujan Theta Functions.
FORMULA
Fine gives an explicit formula for a(n) in terms of the divisors of n.
a(n) = number of divisors of n of form 8n+1, 8n+5, 8n+6 minus number of divisors of form 8n+2, 8n+3, 8n+7. [I think Fine's version is simpler - N. J. A. Sloane]
G.f.: s(8)^4/(s(4)^2), where s(k) := subs(q=q^k, eta(q)), where eta(q) is Dedekind's function, cf. A010815. [Fine]
Expansion of q * psi(q^4)^2 in powers of q where psi() is a Ramanujan theta function. - Michael Somos, Feb 22 2015
Expansion of eta(q^8)^4 / eta(q^4)^2 in powers of q.
Euler transform of period 8 sequence [ 0, 0, 0, 2, 0, 0, 0, -2, ...]. - Michael Somos, Apr 24 2004
a(n)=0 unless n=4k+1 in which case a(n) is the difference between number of divisors of n of form 4k+1 and 4k+3.
Multiplicative with a(2^e) = 0^e, a(p^e) = (1 + (-1)^e)/2 if p==3 mod 4 otherwise a(p^e) = 1+e. - Michael Somos, Sep 18 2004
Moebius transform is period 8 sequence [ 1, -1, -1, 0, 1, 1, -1, 0, ...]. - Michael Somos, Sep 02 2005
G.f.: Sum_{k>0} Kronecker(-4, k) * x^k / (1 - x^(2*k)) = Sum_{k>0} x^(2*k - 1) / (1 + x^(4*k - 2)). - Michael Somos, Sep 20 2005
G.f.: Sum_{k>0} x^k * (1 - x^k) * (1 - x^(2*k)) * (1 - x^(3*k)) / (1 - x^(8*k)) = x Product_{k>0} (1 - x^(8*k))^4 / (1 - x^(4*k))^2. - Michael Somos, Apr 24 2004
a(4*n + 1) = A008441(n).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/8 = 0.392699... (A019675). - Amiram Eldar, Oct 23 2022
Dirichlet g.f.: L(chi_1,s)*L(chi_{-1},s) = L(chi_s)*beta(s), where chi_1 = A000035 and chi_{-1} = A101455 are respectively the principal and the non-principal Dirichlet character modulo 4, and beta(s) is the Dirichlet beta function. For the formula of the sequence whose Dirichlet g.f. is Product_{chi} L(chi,s), where chi runs through all Dirichlet characters modulo k, see A378006. This sequence is the case k = 4. - Jianing Song, Nov 13 2024
EXAMPLE
G.f. = q + 2*q^5 + q^9 + 2*q^13 + 2*q^17 + 3*q^25 + 2*q^29 + 2*q^37 + ...
MATHEMATICA
a[n_] := Sum[{0, 1, -1, -1, 0, 1, 1, -1}[[Mod[d, 8] + 1]], {d, Divisors[n]}]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, May 15 2013, after Michael Somos *)
a[ n_] := SeriesCoefficient[ EllipticTheta[ 2, 0, x^2]^2 / 4, {x, 0, n}]; (* Michael Somos, Feb 22 2015 *)
a[ n_] := If[ n < 1 || Mod[n, 4] != 1, 0, Sum[ KroneckerSymbol[ 4, d], {d, Divisors @n}]]; (* Michael Somos, Feb 22 2015 *)
PROG
(PARI) {a(n) = if( n<1 || n%4!=1, 0, sumdiv(n, d, (d%4==1) - (d%4==3)))}; /* Michael Somos, Apr 24 2004 */
(PARI) {a(n) = if( n<1, 0, sumdiv(n, d, [0, 1, -1, -1, 0, 1, 1, -1][d%8+1]))}; /* Michael Somos, Apr 24 2004 */
(PARI) {a(n) = local(A); if( n<1, 0, n--; A = x * O(x^n); polcoeff( eta(x^8 + A)^4 / eta(x^4 + A)^2, n))}; /* Michael Somos, Apr 24 2004 */
(Magma) A := Basis( ModularForms( Gamma1(16), 1), 106); A[2] + 2*A[6]; /* Michael Somos, Feb 22 2015 */
(Python)
from sympy import divisors
def A008442(n): return 0 if n&3!=1 else sum(((a:=d&3)==1)-(a==3) for d in divisors(n, generator=True)) # Chai Wah Wu, May 17 2023
CROSSREFS
KEYWORD
nonn,mult,changed
AUTHOR
STATUS
approved