login
a(n) = 1 if n is a square, -1 if n is seven times a square, 0 otherwise.
4

%I #18 Jul 02 2024 14:43:40

%S 1,0,0,1,0,0,-1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,

%T 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,

%U 0,0,0,0,0,0,0,0,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,0,0,0,0,0,0,0,-1

%N a(n) = 1 if n is a square, -1 if n is seven times a square, 0 otherwise.

%H Antti Karttunen, <a href="/A245485/b245485.txt">Table of n, a(n) for n = 1..100489</a>

%F a(n) is multiplicative with a(p^e) = (-1)^e if p = 7, a(p^e) = (1 + (-1)^e) / 2 otherwise.

%F G.f.: (theta_3(q) - theta_3(q^7)) / 2 = Sum_{k>0} x^(k^2) - x^(7*k^2).

%F Dirichlet g.f.: zeta(2*s) * (1 - 7^(-*s)). [corrected by _Amiram Eldar_, Oct 24 2023]

%F Sum_{k=1..n} a(k) ~ c*sqrt(n), where c = 1 - 1/sqrt(7) = 0.6220355... . - _Amiram Eldar_, Oct 24 2023

%e G.f. = q + q^4 - q^7 + q^9 + q^16 + q^25 - q^28 + q^36 + q^49 - q^63 + ...

%t a[ n_] := Boole[ IntegerQ[ Sqrt[ n]]] - Boole[ IntegerQ[ Sqrt[ 7 n]]];

%t a[ n_] := SeriesCoefficient[ (EllipticTheta[ 3, 0, q] - EllipticTheta[ 3, 0, q^7]) / 2, {q, 0, n}];

%t Table[Which[IntegerQ[Sqrt[n]],1,IntegerQ[Sqrt[n/7]],-1,True,0],{n,120}] (* _Harvey P. Dale_, May 19 2019 *)

%o (PARI) {a(n) = issquare(n) - issquare(7*n)};

%o (PARI) {a(n) = if( n<1, 0, direuler( p=2, n, if( p==7, 1 - X, 1) / (1 - X^2 ))[n])};

%o (Magma) Basis( ModularForms( Gamma1(28), 1/2), 86) [2] ;

%Y Cf. A214293, A214295, A244612.

%K sign,mult

%O 1,1

%A _Michael Somos_, Jul 23 2014

%E Data section extended up to a(112) by _Antti Karttunen_, Jul 02 2024