Sieve methods and Brun–Titchmarsh
Count survivors of divisibility filters and apply a uniform upper bound with its correct range.
On this page
The question for today
What you’ll understand
- Derive a finite sieve identity using inclusion–exclusion.
- Explain why accumulated remainder terms constrain a sieve level.
- Apply Brun–Titchmarsh only in its stated coprimality and size range.
A sieve counts integers by removing residue classes associated with small prime divisors. It often produces upper bounds in ranges where a precise asymptotic for primes is unavailable. The basic inclusion–exclusion identity is exact, but useful estimates depend on how many divisibility conditions one can control simultaneously. Brun–Titchmarsh illustrates the result: a uniform upper bound for eligible prime progressions, with a denominator that explicitly measures the modulus relative to the endpoint.
Start with a finite identity
Let be the product of primes below a finite threshold, and consider integers in a finite set or with nonnegative finitely supported weights. An integer survives if it is divisible by none of the selected primes. Expanding the product of one minus each divisibility indicator gives an alternating sum over squarefree divisors of the prime product. The coefficients are exactly Möbius values. Summing first over integers gives the Legendre sieve identity, an arithmetic form of inclusion–exclusion with no approximation yet.
For initial integers through a real endpoint, the count divisible by a divisor is its floor quotient. Substituting the endpoint divided by the divisor plus a bounded remainder suggests a density product. However, the number of divisors of the prime product doubles with every selected prime. Bounding every individual remainder and then summing absolute values can overwhelm the intended main term. A local estimate that looks harmless in isolation is not harmless after an exponentially large inclusion–exclusion expansion.
Upper-bound weights and what survives
Practical sieve methods replace the full alternating expansion by carefully chosen weights with restricted support. For an upper bound, the resulting divisor-weight expression must majorize the survival indicator pointwise; multiplying by nonnegative input weights and summing preserves the inequality. Selberg’s method uses a square of a short divisor sum to guarantee nonnegativity and then optimizes its coefficients. The permitted divisor range balances the size of the main term against accumulated errors. This is a structural explanation, not a proof of the full optimized inequality.
Survival only means absence of the selected prime factors. A composite with both factors above the sieve threshold still survives, and the integer one always survives. Conversely, a selected small prime is removed even though it is prime. Recovering a prime count therefore requires accounting for these exceptions and choosing the threshold appropriately. Basic divisor-density information also has a parity limitation: it need not distinguish integers with an even number of prime factors from those with an odd number sufficiently well to give sharp prime lower bounds. An upper bound should never be reported as a matching asymptotic.
A uniform inequality with a visible range
For real and an integer coprime to , the classical Brun–Titchmarsh inequality gives the displayed upper bound. This formulation has no unspecified asymptotic remainder and is uniform in the eligible residue class and modulus within its stated range. As the modulus approaches the endpoint, the logarithm of their ratio shrinks, making the bound weak. At or below the modulus the displayed denominator is zero or negative, so this version cannot be applied.
For a fixed modulus and large endpoint, the bound is roughly twice the prime-number-theorem main term. That does not mean actual counts are twice their expected scale, nor does the inequality provide a positive lower bound. When the modulus grows as a fixed power of the endpoint, the ratio-logarithm matters substantially and cannot be replaced by the endpoint logarithm without changing the constant. The distinction is useful when summing over many moduli: an individually uniform upper bound can control a difficult range even when a uniform asymptotic has not been established there.
Work it through
A small exact sieve and a progression bound
Sieve the integers through thirty by primes two, three, and five, then apply Brun–Titchmarsh to primes through one hundred in class three modulo ten.
Inclusion–exclusion gives survivors. They are . The selected prime five is included in this finite prime product by choosing a threshold larger than five.
Of those eight survivors, seven are prime and one is the integer one. Reinsert the removed primes two, three, and five to obtain ten primes through thirty. This correction is justified here because every composite through thirty has a prime factor among the three selected primes.
For the progression, and . The bound is . Directly the eligible primes are , giving seven. A loose but correct upper bound is consistent with that exact count.
The exact sieve has eight survivors, while the uniform progression inequality bounds a separate count of seven by approximately 21.715.
The living notebook
Explore the model
Interactive lab · modular
A periodic divisibility filter
Pause/Reset and set modulus 10 and step 1. Step through a full period and mark residues 1, 3, 7, 9 as coprime to ten. For a fresh comparison Pause/Reset, set both modulus 6 and step 1; only residues 1 and 5 are coprime. Reset restores both controls and zero time; changing one control retains time.
- Residue r0
- 0
- Orbit period · m/gcd(m,a)
- 12
- Distinct residues visited
- 1 of 12
Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forRemoving multiples of the modulus’s prime factors leaves a periodic unit pattern. The displayed orbit does not distinguish surviving composites from primes or calculate a Brun–Titchmarsh bound.
Pause & reason
Check your understanding
Your turn
Try it yourself
Bound the primes through one hundred congruent to one modulo four using Brun–Titchmarsh. Compare with the actual count and explain why the same displayed expression cannot be used at endpoint four.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
There are two units modulo four. List primes in the requested class before comparing a finite count with a real-valued bound.
Compare with the solution
The bound is . The actual primes are , so the count is eleven and satisfies the bound. At endpoint four, , so the displayed expression is undefined and its hypothesis fails. A failure of this bound’s range is not a claim that the actual finite counting problem has no answer.
Keep the idea
Take it with you
- A finite sieve identity counts divisibility survivors, with explicit exceptions before it becomes a prime count.
- Accumulated remainder terms limit the usable divisor range and motivate optimized sieve weights.
- Brun–Titchmarsh is a uniform upper bound for coprime classes with endpoint strictly larger than modulus.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.