login
a(n) = Product_{ p | n } (1 + Legendre(-1,p) ).
10

%I #23 Oct 11 2022 06:34:43

%S 1,2,0,2,2,0,0,2,0,4,0,0,2,0,0,2,2,0,0,4,0,0,0,0,2,4,0,0,2,0,0,2,0,4,

%T 0,0,2,0,0,4,2,0,0,0,0,0,0,0,0,4,0,4,2,0,0,0,0,4,0,0,2,0,0,2,4,0,0,4,

%U 0,0,0,0,2,4,0,0,0,0,0,4,0,4,0,0,4,0,0,0,2,0,0,0,0,0,0,0,2,0,0,4,2,0,0,4,0

%N a(n) = Product_{ p | n } (1 + Legendre(-1,p) ).

%D Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton, 1971, see p. 25, Eq. (2) (but without the restriction that a(4k) = 0 and with a different definition of Legendre(-1,2)).

%H Antti Karttunen, <a href="/A091379/b091379.txt">Table of n, a(n) for n = 1..65537</a>

%F Here we use the definition that Legendre(-1, 2) = 1, Legendre(-1, p) = 1 if p == 1 mod 4, = -1 if p == 3 mod 4.

%F From _Amiram Eldar_, Oct 11 2022: (Start)

%F Multiplicative with a(p^e) = 0 if p == 3 (mod 4) and 2 otherwise.

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/Pi = 0.954929... (A089491). (End)

%p with(numtheory); A091379 := proc(n) local i,t1,t2; t1 := ifactors(n)[2]; t2 := mul((1+legendre(-1,t1[i][1])),i=1..nops(t1)); end;

%t a[n_] := Module[{t1, t2}, t1 = FactorInteger[n]; t2 = Product[(1 + KroneckerSymbol[-1, t1[[i, 1]]]), {i, 1, Length[t1]}]]; a[1] = 1;

%t Array[a, 105] (* _Jean-François Alcover_, Feb 08 2022, from Maple code *)

%o (PARI)

%o vecproduct(v) = { my(m=1); for(i=1,#v,m *= v[i]); m; };

%o A091379(n) = vecproduct(apply(p -> (1 + kronecker(-1,p)), factorint(n)[, 1])); \\ _Antti Karttunen_, Nov 18 2017

%Y Cf. A000086, A000091, A034444, A089491, A091392, A091393, A091394, A091395, A091396, A091397, A091398, A091399, A091400.

%K nonn,mult

%O 1,2

%A _N. J. A. Sloane_, Mar 02 2004