login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007424 a(n) = 1 if n is squarefree, otherwise 2.
(Formerly M0060)
5

%I M0060 #31 Sep 26 2022 05:45:01

%S 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,

%T 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,

%U 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

%N a(n) = 1 if n is squarefree, otherwise 2.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

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

%H <a href="/index/Eu#epf">Index entries for sequences computed from exponents in factorization of n</a>.

%F a(n) = 2 - A008966(n). - _Antti Karttunen_, Nov 18 2017

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2 - 6/Pi^2 = 1 + A229099. - _Amiram Eldar_, Sep 26 2022

%t f[n_]:=Union[Last/@FactorInteger[n]][[ -1]];lst={1};Do[If[f[n]==1,AppendTo[lst,1],AppendTo[lst,2]],{n,2,6!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Mar 07 2010 *)

%t Table[If[SquareFreeQ[n],1,2],{n,100}] (* _Harvey P. Dale_, Jul 09 2014 *)

%o (MuPAD) func(2-abs(numlib::moebius(n)), n):

%o (PARI) A007424(n) = (2-issquarefree(n)); \\ _Antti Karttunen_, Nov 18 2017

%Y Cf. A005117, A008966, A107078, A229099.

%K easy,nonn

%O 1,4

%A _N. J. A. Sloane_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 08:11 EDT 2024. Contains 371905 sequences. (Running on oeis4.)