A366091 a(n) is the number of ways to write n = i^2 + 2*j^2 + 3*k^2 with i,j,k >= 0.
1, 1, 1, 2, 2, 1, 2, 1, 1, 3, 0, 2, 4, 1, 2, 2, 2, 1, 3, 2, 2, 4, 2, 1, 2, 2, 0, 4, 3, 2, 5, 2, 1, 3, 2, 2, 7, 2, 2, 5, 0, 2, 0, 2, 4, 4, 3, 1, 4, 3, 3, 5, 3, 2, 7, 1, 2, 6, 0, 3, 6, 2, 2, 4, 2, 2, 6, 3, 2, 4, 3, 3, 3, 2, 0, 7, 5, 2, 6, 3, 2, 8, 2, 2, 11, 2, 5, 2, 2, 3, 0, 4, 3, 7, 3, 2, 2, 3, 3
Offset: 0
Keywords
Examples
a(9) = 3 because 9 = 3^2 + 2*0^2 + 3*0^2 = 1^2 + 2*2^2 + 3*0^2 = 2^2 + 2*1^2 + 3*1^2.
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Programs
-
Maple
g:= (1+JacobiTheta3(0,z))*(1+JacobiTheta3(0,z^2))*(1+JacobiTheta3(0,z^3))/8: S:= series(g,z,101): seq(coeff(S,z,j),j=0..100);
-
Python
from itertools import count from sympy.ntheory.primetest import is_square def A366091(n): c = 0 for k in count(0): if (a:=3*k**2)>n: break for j in count(0): if (b:=a+(j**2<<1))>n: break if is_square(n-b): c += 1 return c # Chai Wah Wu, Sep 29 2023
Formula
G.f. (1 + theta_3(0,z)) * (1 + theta_3(0,z^2)) * (1 + theta_3(0,z^3))/8 where theta_3 is a Jacobi theta function.