A007424 a(n) = 1 if n is squarefree, otherwise 2.
1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 2, 2
Offset: 1
References
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
Programs
-
Mathematica
Table[If[SquareFreeQ[n],1,2],{n,100}] (* Harvey P. Dale, Jul 09 2014 *)
-
MuPAD
func(2-abs(numlib::moebius(n)), n):
-
PARI
A007424(n) = (2-issquarefree(n)); \\ Antti Karttunen, Nov 18 2017
Formula
a(n) = 2 - A008966(n). - Antti Karttunen, Nov 18 2017
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2 - 6/Pi^2 = 1 + A229099. - Amiram Eldar, Sep 26 2022