login
a(n) = 0 if n is divisible by the square of odd prime, a(n) = 1 if n is an odd squarefree number, a(n) = 2 otherwise.
1

%I #19 Aug 27 2023 04:22:48

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

%T 1,0,1,2,1,2,1,2,1,2,0,2,1,2,0,0,1,2,1,0,1,2,1,2,1,2,1,2,0,2,1,2,1,2,

%U 1,2,1,0,1,2,0,2,1,2,1,2,0,2,1,2,1,2,1,2,1,0,1,2,1,2,1,2,1,0,0,0,1,2,1,2,1

%N a(n) = 0 if n is divisible by the square of odd prime, a(n) = 1 if n is an odd squarefree number, a(n) = 2 otherwise.

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

%F Dirichlet g.f.: zeta(s)/zeta(2s)*2^s/(2^s-1). - _Ralf Stephan_, Jun 17 2007

%F Sum_{k=1..n} a(k) ~ 12*n / Pi^2. - _Vaclav Kotesovec_, Feb 02 2019

%F Multiplicative with a(2^e) = 2, and for an odd prime p a(p^e) = 1 if e = 1 and 0 otherwise. - _Amiram Eldar_, Aug 27 2023

%t f[p_, e_] := If[e == 1, 1, 0]; f[2, e_] := 2; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* _Amiram Eldar_, Aug 27 2023 *)

%o (PARI) a(n)=if(n<1,0,direuler(p=2,n,if(p%2==1,1+X,if(p%2,1,(1+X)/(1-X))))[n])

%o (PARI) A078461(n) = (issquarefree(n/2^valuation(n,2))*(2-(n%2))); \\ _Antti Karttunen_, Sep 27 2018

%Y Cf. A038838, A056911.

%K mult,nonn,easy

%O 1,2

%A _Benoit Cloitre_, Dec 31 2002