How Do You Count Something That Never Ends?
Here are three statements about the prime numbers. All three are true:
- There are infinitely many primes.
- There are exactly as many primes as whole numbers.
- 0% of whole numbers are prime.
They sound contradictory. They aren't, because each uses a different way of measuring an infinite collection. When something never ends, "how many?" stops having a single answer. Mathematicians developed several tools, each answering a different version of the question.
"How Many" Splits Into Several Questions
For finite collections, counting, comparing, and finding proportions all give consistent answers. For infinite collections, they come apart:
| Question | Tool | Primes vs. whole numbers |
|---|---|---|
| Can they be paired one-to-one? | Cardinality | Same size |
| What fraction of numbers belong? | Natural density | 0% |
| How fast do they accumulate? | Growth rate | About x / ln x up to x |
| How much "length" do they take up? | Measure | Zero |
Choosing the right tool depends on what you actually want to know.
Tool 1: Cardinality (Pairing Up)
Two sets have the same cardinality if you can pair their elements one-to-one with none left over. Georg Cantor used this definition in the 1870s.
Primes can be listed in order, 2, 3, 5, 7, 11, …, and paired with 1, 2, 3, 4, 5, … So the primes, the even numbers, the squares and all the whole numbers have the same cardinality, called ℵ₀.
Cardinality is the right tool for questions about existence and matching, but it's blunt: it treats a set and a tiny-looking subset as equal. See What Is Infinity?.
Tool 2: Natural Density (Proportions)
Natural density asks: as you look at larger and larger ranges from 1 to N, what fraction of numbers belong to the set?
density = limit as N → ∞ of (count up to N) / N
| Set | Density |
|---|---|
| Even numbers | 1/2 |
| Multiples of 3 | 1/3 |
| Perfect squares | 0 (only √N of them up to N) |
| Primes | 0 |
| Squarefree numbers (no repeated prime factor) | 6/π² ≈ 60.8% |
This captures our intuition that evens are "half" of all numbers, even though they have the same cardinality. Browse the square numbers list and see how they thin out, and check parity with the even number checker.
Tool 3: Growth Rate (Counting Up to a Limit)
Density 0 hides important differences. There are about √N squares up to N, but about N/ln N primes. Both have density 0, yet primes are far more common.
So mathematicians often study the counting function directly:
Squares up to N: ≈ √N
Primes up to N: ≈ N / ln N (the prime number theorem)
Twin primes: ≈ 1.32 × N / (ln N)² (conjectured)
Powers of 2: ≈ log₂ N
Up to one million: about 1,000 squares, 78,498 primes, and just 20 powers of two. Growth rates give the most detailed picture of "how many" for sets of whole numbers. Compare the primes in the list of prime numbers.
Tool 4: Measure (Length on the Number Line)
For sets of real numbers, a different idea applies: measure, a generalization of length.
- The interval from 0 to 1 has measure 1.
- A single point has measure 0.
- The rational numbers between 0 and 1, infinitely many and densely packed, have measure 0.
Here's the reason. List the rationals as q₁, q₂, q₃, … Cover q₁ with an interval of length ε/2, q₂ with ε/4, q₃ with ε/8, and so on. The total length is at most ε, for any ε > 0 you choose, no matter how small. So the rationals take up no length at all.
That's why a "randomly chosen" real number is irrational with probability 1. See Why Some Numbers Cannot Be Written as Fractions.
An Insider Reference: Borel, Lebesgue and Ordinals
The modern theory of measure was developed by French mathematicians Émile Borel in 1898 and Henri Lebesgue, whose 1902 doctoral thesis introduced the Lebesgue measure and a new theory of integration. Lebesgue integration became the foundation of modern probability theory, formalized by Andrey Kolmogorov in 1933.
Cantor also introduced a second kind of infinite number, ordinals, around 1883, for counting positions in order rather than sizes. With ordinals, order matters in surprising ways:
1 + ω = ω (one item placed before an infinite list: still the same shape)
ω + 1 ≠ ω (an infinite list with one item after it: a new shape)
Here ω (omega) represents the order type of 1, 2, 3, … Putting one element before an infinite sequence changes nothing, but putting one after all of them creates something genuinely new.
Two Concepts Worth Knowing
Countable Set
A set is countable if its elements can be listed in a sequence (possibly infinite). Whole numbers, integers, primes and fractions are countable; real numbers aren't.
Measure Zero
A set has measure zero if it can be covered by intervals of arbitrarily small total length. Countable sets always have measure zero, but some uncountable sets, like the Cantor set, do too.
Quick Answer: How Do Mathematicians Count Infinite Sets?
Mathematicians use different tools for different questions. Cardinality compares sizes by pairing elements one-to-one. Natural density measures what proportion of whole numbers belong to a set. Counting functions measure how fast a set grows. Measure generalizes length for sets of real numbers. For example, primes have the same cardinality as whole numbers, density 0, and grow like N/ln N.
Try Them Yourself
- List of Prime Numbers: count primes up to a limit
- Square Numbers List: watch density fall to zero
- Even Number Checker: the set with density 1/2
- Logarithm Calculator: compare N/ln N with actual prime counts
- Can Infinity Be Bigger Than Infinity?: cardinalities beyond ℵ₀
- The Infinite Hotel: cardinality as a story
Count the primes, squares and even numbers up to 100, then up to 1,000. Divide each count by the limit. Watch one proportion stay steady while the other two shrink.