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!)
A005087 Number of distinct odd primes dividing n. 28

%I #45 Sep 28 2023 04:22:32

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

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

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

%N Number of distinct odd primes dividing n.

%H Lei Zhou, <a href="/A005087/b005087.txt">Table of n, a(n) for n = 1..10000</a>

%F Additive with a(p^e) = 0 if p = 2, 1 otherwise.

%F a(n) = A001221(n) - 1 + n mod 2. - _Reinhard Zumkeller_, Sep 03 2003

%F O.g.f.: Sum_{p=odd prime} x^p/(1-x^p). - _Geoffrey Critzer_, Nov 06 2012

%F Sum_{k=1..n} a(k) = n * log(log(n)) + c * n + O(n/log(n)), where c = A077761 - 1/2 = -0.238502... . - _Amiram Eldar_, Sep 28 2023

%t nn=100; a=Sum[x^p/(1-x^p), {p, Table[Prime[n],{n,2,nn}]}]; Drop[CoefficientList[Series[a, {x,0,nn}],x],1] (* _Geoffrey Critzer_, Nov 06 2012 *)

%t Array[PrimeNu[#] - Boole[EvenQ[#]] &, 102] (* _Lei Zhou_, Dec 03 2012 *)

%o (Sage)

%o def A005087(n) : return len(prime_divisors(n)) + n % 2 - 1

%o [A005087(n) for n in (1..80)] # Peter Luschny, Feb 01 2012

%o (Haskell)

%o a005087 n = a001221 n + n `mod` 2 - 1 -- _Reinhard Zumkeller_, Feb 28 2014

%o (Python)

%o from sympy import primefactors

%o def A005087(n): return len(primefactors(n))+(n&1)-1 # _Chai Wah Wu_, Jul 07 2022

%o (PARI) a(n) = if (n%2, omega(n), omega(n)-1); \\ _Michel Marcus_, Sep 18 2023

%Y Cf. A001221, A077761, A087436.

%Y Positions of zeros: A000079.

%Y Positions of ones: A336101.

%K nonn,easy

%O 1,15

%A _N. J. A. Sloane_

%E More terms from _Reinhard Zumkeller_, Sep 03 2003

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 25 05:56 EDT 2024. Contains 371964 sequences. (Running on oeis4.)