Ma · Mathematics

What Does ω(n) Mean? Distinct Prime Factors Explained

Updated 13 October 2026

At a glance

  1. 1. Start with n

    The usual arithmetic-function definition applies to positive integers.

  2. 2. Find prime divisors

    Write the prime factorization, or identify each prime divisor by trial division.

  3. 3. Count each once

    Count every different prime once, regardless of its exponent.

  4. 4. Check the boundary

    The integer 1 has no prime divisors, so its value is zero.

The notation ω(n) is used in number theory for the number of distinct prime divisors of an integer n. It counts which primes occur, not how many times each occurs.

The key is to find the prime factorization and count the different primes appearing in it. This article gives the definition, a worked example, and the distinction between ω(n) and the closely related function Ω(n).

Definition of ω(n)

For a positive integer n, ω(n) is the number of primes that divide n. If the prime factorization is

n=∏i=1kpiai,n = \prod_{i=1}^{k} p_i^{a_i},

where the pᵢ are distinct primes and each exponent aᵢ is positive, then

ω(n)=k.\omega(n)=k.

For example, if a number factors into powers of 2, 3, and 5, then its value of ω is 3, whatever positive exponents those primes have. A prime number has ω(n) = 1, because its only prime divisor is itself. The integer 1 has no prime divisors, so ω(1) = 0.

Equivalently, ω(n) counts the members of the set of prime divisors of n. The exponents in the factorization do not affect the count.

Worked example

Take n = 360. Its prime factorization is

360=23⋅32⋅5.360 = 2^3 \cdot 3^2 \cdot 5.

The distinct prime divisors are 2, 3, and 5. Therefore,

ω(360)=3.\omega(360)=3.

The exponents 3 and 2 do not add extra prime factors to this count. If you instead counted every occurrence of a prime in the factorization, you would get 3 + 2 + 1 = 6. That is a different function, written Ω(n).

How to calculate it

If you have the factorization, count its distinct prime bases. If you do not, use trial division:

  1. Try prime divisors in increasing order, starting with 2.
  2. Whenever a prime divides the remaining number, increase the count by one.
  3. Divide out all copies of that prime before testing the next one.
  4. Continue until the remaining number is 1, or until the next trial prime exceeds the square root of the remaining number. If a remainder greater than 1 is left at that point, it is prime and contributes one more.

For 360, dividing out all factors of 2 leaves 45; dividing out all factors of 3 leaves 5; and 5 is prime. The three primes found give ω(360) = 3. Removing all copies at once prevents repeated powers from being counted multiple times.

Difference between ω(n) and Ω(n)

The lowercase and uppercase omega functions count different things:

FunctionWhat it countsExample for 360
ω(n)Distinct prime divisors3
Ω(n)Prime factors including repetitions6

In general, if n = p₁ᵃ¹ ··· pₖᵃᵏ, then ω(n) = k, while Ω(n) = a₁ + ··· + aₖ. For a square-free number, all exponents are 1, so the two values are equal. Otherwise, Ω(n) is larger than ω(n).

A useful property

If m and n are coprime, they have no prime divisor in common. Their distinct prime factors therefore combine without overlap:

ω(mn)=ω(m)+ω(n)when gcd⁡(m,n)=1.\omega(mn)=\omega(m)+\omega(n) \quad\text{when } \gcd(m,n)=1.

The condition matters. For example, 12 and 18 each have two distinct prime divisors, 2 and 3. But their product, 216 = 2³ · 3³, still has only two distinct prime divisors—not four—because both numbers share the same primes.

Common mistakes and edge cases

  • Counting repeated powers: For 2³ · 3² · 5, ω is 3, not 6. The value 6 is Ω.
  • Assuming ω(n) is the largest prime factor: It counts how many distinct primes divide n, not the size of any of them.
  • Forgetting 1: Since 1 has no prime divisors, ω(1) = 0.
  • Applying the usual definition to zero: The standard arithmetic function is defined on positive integers. Every prime divides 0, so a literal extension would give infinitely many prime divisors; ω(0) is therefore not normally assigned a finite value.
  • Using negative inputs without a convention: When extending the notation to negative integers, the usual choice is ω(n) = ω(|n|), since a negative sign does not introduce a prime factor.

References

  1. Introduction to Analytic Number Theory, Tom M. Apostol
  2. An Introduction to the Theory of Numbers, G. H. Hardy and E. M. Wright

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.