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”).

A005087
Number of distinct odd primes dividing n.
28
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, 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, 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
OFFSET
1,15
FORMULA
Additive with a(p^e) = 0 if p = 2, 1 otherwise.
a(n) = A001221(n) - 1 + n mod 2. - Reinhard Zumkeller, Sep 03 2003
O.g.f.: Sum_{p=odd prime} x^p/(1-x^p). - Geoffrey Critzer, Nov 06 2012
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
MATHEMATICA
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 *)
Array[PrimeNu[#] - Boole[EvenQ[#]] &, 102] (* Lei Zhou, Dec 03 2012 *)
PROG
(Sage)
def A005087(n) : return len(prime_divisors(n)) + n % 2 - 1
[A005087(n) for n in (1..80)] # Peter Luschny, Feb 01 2012
(Haskell)
a005087 n = a001221 n + n `mod` 2 - 1 -- Reinhard Zumkeller, Feb 28 2014
(Python)
from sympy import primefactors
def A005087(n): return len(primefactors(n))+(n&1)-1 # Chai Wah Wu, Jul 07 2022
(PARI) a(n) = if (n%2, omega(n), omega(n)-1); \\ Michel Marcus, Sep 18 2023
CROSSREFS
Positions of zeros: A000079.
Positions of ones: A336101.
Sequence in context: A375106 A341594 A368774 * A050332 A369258 A337930
KEYWORD
nonn,easy
EXTENSIONS
More terms from Reinhard Zumkeller, Sep 03 2003
STATUS
approved