%I #35 Jan 22 2024 00:16:05
%S 1,1,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,
%T 0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
%U 0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0
%N Characteristic function of squares or three times squares.
%C Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
%C A214284 is a similar sequence except with five instead of three. - _Michael Somos_, Oct 22 2017
%H G. C. Greubel, <a href="/A195198/b195198.txt">Table of n, a(n) for n = 0..1000</a>
%H S. Cooper and M. Hirschhorn, <a href="http://dx.doi.org/10.1216/rmjm/1008959672">On some infinite product identities</a>, Rocky Mountain J. Math., 31 (2001) 131-139. See p. 133 Theorem 3.
%H Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>
%F Euler transform of period 12 sequence [1, -1, 1, 0, 0, -1, 0, 0, 1, -1, 1, -1, ...].
%F Expansion of psi(q^3) * f(-q^2, -q^10) / f(-q, -q^11) in powers of q where psi(), is a Ramanujan theta function and f(, ) is Ramanujan's general theta function.
%F Multiplicative with a(0) = a(3^e) = 1, a(p^e) = 1 if e even, 0 otherwise.
%F G.f.: (theta_3(q) + theta_3(q^3)) / 2 = 1 + (Sum_{k>0} x^(k^2) + x^(3*k^2)).
%F Dirichlet g.f.: zeta(2*s) * (1 + 3^-s).
%F a(n) = A145377(n) unless n=0. a(3*n + 2) = 0. a(2*n + 1) = A127692(n). a(3*n) = a(n). a(3*n + 1) = A089801(n).
%F Sum_{k=0..n} a(k) ~ (1+1/sqrt(3)) * sqrt(n). - _Amiram Eldar_, Sep 14 2023
%e G.f. = 1 + q + q^3 + q^4 + q^9 + q^12 + q^16 + q^25 + q^27 + q^36 + q^48 + ...
%t a[ n_] := SeriesCoefficient[ Series[ (EllipticTheta[ 3, 0, q] + EllipticTheta[ 3, 0, q^3]) / 2, {q, 0, n}], {q, 0, n}];
%t a[ n_] := If[ n < 0, 0, Boole[ OddQ [ Length @ Divisors @ n] || OddQ [ Length @ Divisors[3 n]]]];
%t Table[If[AnyTrue[{Sqrt[n],Sqrt[3n]},IntegerQ],1,0],{n,0,110}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, May 22 2020 *)
%o (PARI) {a(n) = issquare(n) || issquare(3*n)};
%o (PARI) {a(n) = if( n<1, n==0, direuler( p=2, n, if( p==3, 1 + X, 1) / (1 - X^2))[n])};
%Y Cf. A089801, A127692, A145377, A214284.
%K nonn,mult,easy
%O 0,1
%A _Michael Somos_, Sep 11 2011