The sieve of Eratosthenes is a method for finding all the prime numbers less than some maximum value by repeatedly removing multiples of the smallest remaining prime until no composite numbers less than or equal to
remain. The sieve provides a means of partitioning the natural numbers. We examine this partition and derive an expression for the densities of the constituent “Eratosthenes sets”.

The Sieve of Eratosthenes
The primorial, , is defined to be the product of the first
primes:
The sequence of primorials is and the terms of the sequence grow as
. It is convenient to set
. The algorithm of Eratosthenes goes as follows: starting from the set
, eliminate all multiples of
greater than
; eliminate all remaining multiples of
greater than
; eliminate all remaining multiples of
greater than
. All that remains is the set of the first
prime numbers,
, where
is the largest prime not exceeding
.
The -th “Eratosthenes set”,
, is the set containing
together with all the numbers removed at stage
. Thus,
is the set of all multiples of
, that is, all the even numbers;
is the set of odd multiples of
;
is the set of multiples of
not divisible by
or
;
is the set of multiples of
not divisible by
,
or
; and so on. The
-th row in Table 1 contains the “Eratosthenes set”
.
Let be the set of multiples of
up to
and
the set containing all multiples of
up to
that are not multiples of any smaller prime. Then
Since all primes for
divide
, the sizes of the
-sets are known:
and so
.
Density
We define the density of a set (relative to
) to be
. Then
and
. Clearly, density is additive for disjoint sets. Division by
converts cardinalities to densities. Thus, for example,
By means of the inclusion-exclusion principle, we easily show that the density of the set in (1) is the product of the densities of the component sets on the right side:
Using explicit expressions for the terms on the right, the density of the set is
where . We observe that the numbers
are generated by a recurrence relation
with initial value . This enables us to compute the sequence
. The first eight density values are given in Table 2.

Passage from to
For arbitrary , let
and let
denote
, the set of all multiples of
not exceeding
. Then
and
. The limit of
exists, so that
In this way, we can pass from to
, obtaining the densities of all the Eratosthenes sets in
. In particular, the values of
in Table 2 are also the densities of the first eight (infinite) Eratosthenes sets relative to the natural numbers.
Equations (2) and (3) remain valid in the limit , as does the recurrence relation for
. Thus,
We can show that the series converges. However, the simple ratio test is inadequate, as
, and a more subtle and discriminating test is required (Lynch, 2023). Although the series converges, the convergence rate is quite slow. Writing
we have
,
, and
.
Partitioning the Natural Numbers
Defining , we obtain a partition of the natural numbers
:
The disjoint union in (6) contains all the positive integers, each occurring just once, providing a partition of . Euler’s totient function
counts the natural numbers up to
that are coprime to
. In other words,
is the number of integers
in the range
for which the greatest common divisor
is equal to 1. Clearly, for prime numbers,
.
The number of values coprime to
is, by definition, given by
. But Euler’s function is multiplicative for products of mutually coprime numbers
:
Thus, for , we have
Now, using (3), we can write the density in terms of the totient function:
Defining the cumulative density and noting that, as the sets
are mutually disjoint,
must approach
, we obtain the relationship
This result must be well known, although it has not been found in a cursory search of the literature.
Sources
Lynch, Peter, 2023: The Sieve of Eratosthenes and a Partition of the Natural Numbers. Preprint: PDF
