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

A001221
Number of distinct primes dividing n (also called omega(n)).
(Formerly M0056 N0019)
2267
0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 1, 2, 1, 2, 2, 2, 2, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 2, 3, 2, 1, 2, 1, 3, 2
OFFSET
1,6
COMMENTS
From Peter C. Heinig (algorithms(AT)gmx.de), Mar 08 2008: (Start)
This is also the number of maximal ideals of the ring (Z/nZ,+,*). Since every finite integral domain must be a field, every prime ideal of Z/nZ is a maximal ideal and since in general each maximal ideal is prime, there are just as many prime ideals as maximal ones in Z/nZ, so the sequence gives the number of prime ideals of Z/nZ as well.
The reason why this number is given by the sequence is that the ideals of Z/nZ are precisely the subgroups of (Z/nZ,+). Hence for an ideal to be maximal it has form a maximal subgroup of (Z/nZ,+) and this is equivalent to having prime index in (Z/nZ) and this is equivalent to being generated by a single prime divisor of n.
Finally, all the groups arising in this way have different orders, hence are different, so the number of maximal ideals equals the number of distinct primes dividing n. (End)
Equals double inverse Mobius transform of A143519, where A051731 = the inverse Mobius transform. - Gary W. Adamson, Aug 22 2008
a(n) is the number of unitary prime power divisors of n (not including 1). - Jaroslav Krizek, May 04 2009 [corrected by Ilya Gutkovskiy, Oct 09 2019]
Sum_{d|n} 2^(-A001221(d) - A001222(n/d)) = Sum_{d|n} 2^(-A001222(d) - A001221(n/d)) = 1 (see Dressler and van de Lune link). - Michel Marcus, Dec 18 2012
Up to 2*3*5*7*11*13*17*19*23*29 - 1 = 6469693230 - 1, also the decimal expansion of the constant 0.01111211... = Sum_{k>=0} 1/(10 ^ A000040(k) - 1) (see A073668). - Eric Desbiaux, Jan 20 2014
The average order of a(n): Sum_{k=1..n} a(k) ~ Sum_{k=1..n} log log k. - Daniel Forgues, Aug 13-16 2015
From Peter Luschny, Jul 13 2023: (Start)
We can use A001221 and A001222 to classify the positive integers as follows.
A001222(n) = A001221(n) = 0 singles out {1}.
Restricting to n > 1:
A001222(n)^A001221(n) = 1: A000040, prime numbers.
A001221(n)^A001222(n) = 1: A246655, prime powers.
A001222(n)^A001221(n) > 1: A002808, the composite numbers.
A001221(n)^A001222(n) > 1: A024619, complement of A246655.
n^(A001222(n) - A001221(n)) = 1: A144338, products of distinct primes. (End)
Inverse Möbius transform of the characteristic function of primes (A010051). - Wesley Ivan Hurt, Jun 22 2024
REFERENCES
M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 844.
J. Peters, A. Lodge and E. J. Ternouth, E. Gifford, Factor Table (n<100000) (British Association Mathematical Tables Vol.V), Burlington House/Cambridge University Press London 1935.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
N. J. A. Sloane and Daniel Forgues, Table of n, a(n) for n = 1..100000 (first 10000 from NJAS)
M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards, Applied Math. Series 55, Tenth Printing, 1972 [alternative scanned copy].
Henry Bottomley, Prime factors calculator
Robert E. Dressler and Jan van de Lune, Some remarks concerning the number theoretic functions omega and Omega, Proc. Amer. Math. Soc. 41 (1973), 403-406
G. H. Hardy and S. Ramanujan, The normal number of prime factors of a number, Quart. J. Math. 48 (1917), 76-92. Also Collected papers of Srinivasa Ramanujan, AMS Chelsea Publ., Providence, RI (2000): 262-275.
M. Kac, Statistical Independence in Probability, Analysis and Number Theory, Carus Monograph 12, Math. Assoc. Amer., 1959, see p. 64.
Primefan, Factorer
Eric Weisstein's World of Mathematics, Distinct Prime Factors
Eric Weisstein's World of Mathematics, Moebius Transform
Eric Weisstein's World of Mathematics, Prime Factor
Eric Weisstein's World of Mathematics, Prime zeta function primezeta(s).
Wikipedia, Prime factor
G. Xiao, WIMS server, Factoris
FORMULA
G.f.: Sum_{k>=1} x^prime(k)/(1-x^prime(k)). - Benoit Cloitre, Apr 21 2003; corrected by Franklin T. Adams-Watters, Sep 01 2009
Dirichlet generating function: zeta(s)*primezeta(s). - Franklin T. Adams-Watters, Sep 11 2005
Additive with a(p^e) = 1.
a(1) = 0, a(p) = 1, a(pq) = 2, a(pq...z) = k, a(p^k) = 1, where p, q, ..., z are k distinct primes and k natural numbers. - Jaroslav Krizek, May 04 2009
a(n) = log_2(Sum_{d|n} mu(d)^2). - Enrique Pérez Herrero, Jul 09 2012
a(A002110(n)) = n, i.e., a(prime(n)#) = n. - Jean-Marc Rebert, Jul 23 2015
a(n) = A091221(A091202(n)) = A069010(A156552(n)). - Antti Karttunen, circa 2004 & Mar 06 2017
L.g.f.: -log(Product_{k>=1} (1 - x^prime(k))^(1/prime(k))) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, Jul 30 2018
a(n) = log_2(Sum_{k=1..n} mu(gcd(n,k))^2/phi(n/gcd(n,k))) = log_2(Sum_{k=1..n} mu(n/gcd(n,k))^2/phi(n/gcd(n,k))), where phi = A000010 and mu = A008683. - Richard L. Ollerton, May 13 2021
Sum_{k=1..n} 2^(-a(gcd(n,k)) - A001222(n/gcd(n,k)))/phi(n/gcd(n,k)) = Sum_{k=1..n} 2^(-A001222(gcd(n,k)) - a(n/gcd(n,k)))/phi(n/gcd(n,k)) = 1, where phi = A000010. - Richard L. Ollerton, May 13 2021
a(n) = A005089(n) + A005091(n) + A059841(n) = A005088(n) +A005090(n) +A079978(n). - R. J. Mathar, Jul 22 2021
From Wesley Ivan Hurt, Jun 22 2024: (Start)
a(n) = Sum_{p|n, p prime} 1.
a(n) = Sum_{d|n} c(d), where c = A010051. (End)
MAPLE
A001221 := proc(n) local t1, i; if n = 1 then return 0 else t1 := 0; for i to n do if n mod ithprime(i) = 0 then t1 := t1 + 1 end if end do end if; t1 end proc;
A001221 := proc(n) nops(numtheory[factorset](n)) end proc: # Emeric Deutsch
MATHEMATICA
Array[ Length[ FactorInteger[ # ] ]&, 100 ]
PrimeNu[Range[120]] (* Harvey P. Dale, Apr 26 2011 *)
PROG
(MuPAD) func(nops(numlib::primedivisors(n)), n):
(MuPAD) numlib::omega(n)$ n=1..110 // Zerinvary Lajos, May 13 2008
(PARI) a(n)=omega(n)
(Sage)
def A001221(n): return sum(1 for p in divisors(n) if is_prime(p))
[A001221(n) for n in (1..80)] # Peter Luschny, Feb 01 2012
(SageMath) [sloane.A001221(n) for n in (1..111)] # Giuseppe Coppoletta, Jan 19 2015
(SageMath) [gp.omega(n) for n in range(1, 101)] # G. C. Greubel, Jul 13 2024
(Haskell)
import Math.NumberTheory.Primes.Factorisation (factorise)
a001221 = length . snd . unzip . factorise
-- Reinhard Zumkeller, Nov 28 2015
(Python)
from sympy.ntheory import primefactors
print([len(primefactors(n)) for n in range(1, 1001)]) # Indranil Ghosh, Mar 19 2017
(Magma) [#PrimeDivisors(n): n in [1..120]]; // Bruno Berselli, Oct 15 2021
(Julia)
using Nemo
function NumberOfPrimeFactors(n; distinct=true)
distinct && return length(factor(ZZ(n)))
sum(e for (p, e) in factor(ZZ(n)); init=0)
end
println([NumberOfPrimeFactors(n) for n in 1:60]) # Peter Luschny, Jan 02 2024
CROSSREFS
Cf. A001222 (primes counted with multiplicity), A046660, A285577, A346617. Partial sums give A013939.
Sum of the k-th powers of the primes dividing n for k=0..10: this sequence (k=0), A008472 (k=1), A005063 (k=2), A005064 (k=3), A005065 (k=4), A351193 (k=5), A351194 (k=6), A351195 (k=7), A351196 (k=8), A351197 (k=9), A351198 (k=10).
Sequences of the form n^k * Sum_{p|n, p prime} 1/p^k for k=0..10: this sequence (k=0), A069359 (k=1), A322078 (k=2), A351242 (k=3), A351244 (k=4), A351245 (k=5), A351246 (k=6), A351247 (k=7), A351248 (k=8), A351249 (k=9), A351262 (k=10).
Sequence in context: A322307 A087802 A079553 * A064372 A343943 A370817
KEYWORD
nonn,easy,nice,core
STATUS
approved