advanced30 min studyLesson 589 in Mathematics

Sieve methods and Brun–Titchmarsh

Count survivors of divisibility filters and apply a uniform upper bound with its correct range.

On this page

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 P(z)P(z) 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.

S(x,z)=∑n≤x(n,P(z))=11=∑d∣P(z)μ(d)⌊xd⌋.S(x,z)=\sum_{\substack{n\leq x\\(n,P(z))=1}}1=\sum_{d\mid P(z)}\mu(d)\left\lfloor\frac xd\right\rfloor.
This exact finite identity counts survivors, including the integer one; it does not automatically count primes.↔ Scroll wide equations horizontally.

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 x>q≥2x>q\geq2 and an integer aa coprime to qq, 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.

π(x;q,a)≤2xφ(q)log⁡(x/q)(x>q≥2, (a,q)=1).\pi(x;q,a)\leq\frac{2x}{\varphi(q)\log(x/q)}\qquad(x>q\geq2,\ (a,q)=1).
The positive logarithm and the eligible-class condition are hypotheses of this explicit uniform upper bound.↔ Scroll wide equations horizontally.

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.

  1. Inclusion–exclusion gives 30−15−10−6+5+3+2−1=830-15-10-6+5+3+2-1=8 survivors. They are 1,7,11,13,17,19,23,291,7,11,13,17,19,23,29. The selected prime five is included in this finite prime product by choosing a threshold larger than five.

  2. 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.

  3. For the progression, φ(10)=4\varphi(10)=4 and 100>10100>10. The bound is 200/(4log⁡10)≈21.7147200/(4\log10)\approx21.7147. Directly the eligible primes are 3,13,23,43,53,73,833,13,23,43,53,73,83, giving seven. A loose but correct upper bound is consistent with that exact count.

The result

The exact sieve has eight survivors, while the uniform progression inequality bounds a separate count of seven by approximately 21.715.

Explore the model

Interactive lab

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.

A periodic divisibility filterAddition 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. Current readings: Residue r0: 0; Orbit period · m/gcd(m,a): 12; Distinct residues visited: 1 of 12. All parameters are adjustable with the labeled controls below.Repeated addition modulo 12: the current residue is 0, and the orbit period is 12.01234567891011+ 5mod 12An additive orbitn = 0rₙ = 0Period = 12Cycle starts at 0:0 → 5 → 10 → 3 →8 → 1 → 6 → 11 →4 → 9 → 2 → 7 → 0Exact residues · two additions per second
Additive orbitCurrent residue / next edge
Residue r0
0
Orbit period · m/gcd(m,a)
12
Distinct residues visited
1 of 12
t = 0 s

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.

Check your understanding

Which parameter choice satisfies the hypotheses of the displayed Brun–Titchmarsh inequality?

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 200/(2log⁡25)=100/log⁡25≈31.0667200/(2\log25)=100/\log25\approx31.0667. The actual primes are 5,13,17,29,37,41,53,61,73,89,975,13,17,29,37,41,53,61,73,89,97, so the count is eleven and satisfies the bound. At endpoint four, log⁡(x/q)=log⁡1=0\log(x/q)=\log1=0, so the displayed expression is undefined and its hypothesis x>qx>q fails. A failure of this bound’s range is not a claim that the actual finite counting problem has no answer.

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.