%I #16 Nov 16 2023 07:44:05
%S 1,0,0,1,0,0,2,0,3,0,0,0,2,0,0,1,0,0,2,0,0,0,0,0,1,0,3,2,0,0,2,0,0,0,
%T 0,3,2,0,0,0,0,0,2,0,0,0,0,0,3,0,0,2,0,0,0,0,0,0,0,0,2,0,6,1,0,0,2,0,
%U 0,0,0,0,2,0,0,2,0,0,2,0,3,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,2,0,0,1,0,0,2,0,0
%N Expansion of (theta_3(q) * theta_3(q^27) + theta_2(q) * theta_2(q^27) - 1) / 2 in powers of q.
%C Half the number of integer solutions to x^2 + x*y + 7*y^2 = n. - _Jianing Song_, Nov 20 2019
%F a(n) is multiplicative and a(3^e) = 3 if e>1, a(p^e) = e+1 if p == 1 (mod 6), a(p^e) = (1 + (-1)^e) / 2 if p == 5 (mod 6).
%F a(3*n + 2) = a(4*n + 2) = 0.
%F G.f.: (Sum_{i,j} x^(i*i + i*j + 7*j*j) - 1) / 2.
%F A138805(n) = 2 * a(n) unless n=0. A033687(n) = a(3*n + 1). A097195(n) = a(6*n + 1). A123884(n) = a(12*n + 1). 2 * A121361(n) = a(12*n + 7).
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Pi/(3*sqrt(3)) = 0.604599... (A073010). - _Amiram Eldar_, Nov 16 2023
%e q + q^4 + 2*q^7 + 3*q^9 + 2*q^13 + q^16 + 2*q^19 + q^25 + 3*q^27 + ...
%t f[p_, e_] := If[Mod[p, 6] == 1, e + 1, (1 + (-1)^e)/2]; f[2, e_] := 1 - Mod[e, 2]; f[3, e_] := 3; f[3, 1] = 0; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Sep 07 2023 *)
%o (PARI) {a(n) = if( n<1, 0, if( n%3 == 2, 0, if( n%3==1, sumdiv(n, d, kronecker(-3, d)), if( n%9==0, 3 * sumdiv(n/9, d, kronecker(-3, d))))))}
%o (PARI) {a(n) = if( n<1, 0, sumdiv(n, d, kronecker(-3, d)) - if( n%3==0, sumdiv(n/3, d, [0, 1, -1, -3, 1, -1, 3, 1, -1][d%9+1])))}
%o (PARI) {a(n) = if( n<1, 0, qfrep([2, 1; 1, 14], n, 1)[n])}
%Y Cf. A138805 (number of integer solutions to x^2 + x*y + 7*y^2 = n).
%Y Cf. A033687, A073010, A097195, A123884, A121361.
%Y Similar sequences: A096936, A113406, A110399.
%K nonn,easy,mult
%O 1,7
%A _Michael Somos_, Mar 30 2008