Number of distinct prime factors, omega(n)

This is a historically interesting question as it led Hardy and Ramanujan to lay the foundation to probabilistic number theory in course of their solution to this problem. Given $n$ there is no non-trivial deterministic closed form formula for the number of distinct prime factors of $n$. However we have very good probabilistic formula for the same.

Hardy and Ramanujan proved that for almost all integers, the number is distinct primes dividing a number $n$ is formula

$$ \omega(n) \sim \log\log n. $$

We can do much better than the Hardy-Ramanujan estimate and find and estimate of $\omega(n)$ which can be bounded by normal distribution. Erdos and Kac imporved the estimate of $\omega(n)$ and proved that

$$ \lim_{x \to \infty} \frac{1}{x}\# \Big\{n\le x, \frac{\omega(n) - \log\log n}{\sqrt{\log\log n}} \le t \Big\} = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{t}e^{-\frac{u^2}{2}}du $$

This formula says that if $n$ is a large number, we can estimate the distribution of the number of prime factors for numbers of this range. For example we can show that around 12.6% of 10,000 digit numbers are constructed from 10 distinct prime numbers and around 68% (±$\sigma$) are constructed from between 7 and 13 distinct primes.


This is commonly known as $\omega(n)$. See Wikipedia.


We do not have the closed form solutions you claim. We have formulas that assume that we know the prime factorization.