Number of distinct prime factors, omega(n) Is there a formula that can tell us how many distinct prime factors a number has?
We have closed form solutions for the number of factors a number has and the sum of those factors but not the number of distinct prime factors.
So for example:
\begin{array}{rr}
\text{number} & \text{distinct}\atop \text{prime factors} \\
1&0 \\
2&1 \\
3&1 \\
4&1 \\
5&1 \\
6&2 \\
7&1 \\
8&1 \\
9&1 \\
10&2 
\end{array}
 A: This is commonly known as $\omega(n)$.  See Wikipedia.
A: We do not have the closed form solutions you claim.
We have formulas that assume that we know the
prime factorization.
A: 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.
A: If you want to calculate $\omega(n)$ for a large range of $n$, it's simple to modify the Sieve of Eratosthenes to count distinct prime factors. Instead of marking multiples of each prime, keep a counter for every number and increment instead of marking. SO code example
