Let be a finite nonnegative sequence, let be a set of prime numbers, and define
The sifting function is
For a finite set of integers, take to be the number of occurrences of in ; then counts members divisible by no below . For , write
The weighted sifting function is
Let and let the real Selberg sieve weights vanish unless and . Since
expansion and the distribution hypothesis give
For the optimizing Selberg weights, the main quadratic form is , where
Thus the general upper bound is
If the sieve level is instead defined as the largest possible least common multiple, one supports the individual weights on ; this is the same statement after replacing by .
Write
The sifting function is
For each integer , Möbius inversion in its divisor-indicator form gives
Summing over the finite set and interchanging the finite sums yields
This is the inclusion-exclusion formula encoded by the Möbius function.