login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A078461
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
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, 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, 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
OFFSET
1,2
LINKS
FORMULA
Dirichlet g.f.: zeta(s)/zeta(2s)*2^s/(2^s-1). - Ralf Stephan, Jun 17 2007
Sum_{k=1..n} a(k) ~ 12*n / Pi^2. - Vaclav Kotesovec, Feb 02 2019
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
MATHEMATICA
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 *)
PROG
(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])
(PARI) A078461(n) = (issquarefree(n/2^valuation(n, 2))*(2-(n%2))); \\ Antti Karttunen, Sep 27 2018
CROSSREFS
Sequence in context: A335885 A335875 A107279 * A341945 A280535 A221171
KEYWORD
mult,nonn,easy
AUTHOR
Benoit Cloitre, Dec 31 2002
STATUS
approved