Gap-Class Decomposition of ζ(2) = π²/6

Analytical Framework for Prime Gap Contributions to the Riemann Zeta Function
By Wessen Getachew | 2026
Related work: Modular Sieve Calculator

Theoretical Foundation

Leonhard Euler established in 1734 that the Riemann zeta function at s=2 admits the following representation:

ζ(2) = Σn=1 1/n² = ∏p prime p²/(p²-1) = π²/6 ≈ 1.644934066848...

The Euler product expresses ζ(2) as an infinite product over all prime numbers, where each prime p contributes the multiplicative factor p²/(p²-1).

Gap-Class Partition

This framework introduces a partition of the Euler product based on prime gap classes. Define gap(p) as the forward difference pn+1 - pn for consecutive primes. The Euler product may then be reorganized as:

ζ(2) = ∏g∈{1,2,4,6,...} Pg

where each gap family product is:

Pg = ∏p: gap(p)=g p²/(p²-1)

Gap Classification

Prime gaps partition into the following classes:

Research Objectives

This computational framework enables investigation of the following questions:

  1. Quantitative Contributions: Determine the absolute and relative contribution of each gap class to ζ(2)
  2. Convergence Analysis: Characterize whether individual Pg admit closed-form expressions involving π or other fundamental constants
  3. Asymptotic Behavior: Analyze how Pg scales as g → ∞
  4. Gap Distribution: Examine relationships between gap class populations and analytic properties of ζ(s)
  5. Gap Ratio Convergence: Test Hardy-Littlewood prediction that twin primes (gap 2) and cousin primes (gap 4) have equal asymptotic density — their count ratio should approach 1.0. Note: gap 6 (sexy primes) has a 2× larger HL constant (due to p=3 dividing 6), so it is asymptotically twice as frequent, not equal.
  6. Twin Prime Conjecture Evidence: Measure computational evidence for infinite twin primes through Hardy-Littlewood formula accuracy and gap ratio convergence
  7. Generalization: Test whether this decomposition extends to ζ(2n) for all positive integers n
  8. Conjecture Constraints: Investigate whether gap contribution patterns impose necessary conditions on unproven conjectures

Analytical Methods

The tool employs a Segmented Sieve of Eratosthenes for prime generation, computes exact products Pg for each gap class, tracks progressive convergence to π²/6, and provides high-precision numerical analysis with configurable decimal representation. Browser analysis is reliable up to approximately 300 million; for larger ranges use the companion Python script.

Performance & Browser Limits

This tool runs entirely in your browser. There are two distinct memory stages to be aware of:

For 400M and above, use the companion Python script instead. Unlike the browser, Python processes primes incrementally without storing them — using constant ~50 MB RAM regardless of range. It outputs the same CSV format which can be loaded back here for visualization.

Computation Parameters

Note: Values > 100M may take several minutes
Browser limit: ~300M (use Python script for 400M-1B+)
Progressive Convergence to ζ(2) = π²/6
Shows how the cumulative product P₁ × P₂ × P₄ × ... converges to the target value π²/6 ≈ 1.6449 as we add more gap families. Each gap family's product contributes multiplicatively toward the final value.
Progressive Convergence Data
Individual Gap Family Products Pg
Displays the individual contribution of each gap family. Each bar shows P_g = ∏_{p: gap(p)=g} p²/(p²-1), the product over all primes with that specific gap size. Larger values indicate gap families that contribute more to ζ(2).
Gap Family Product Values (Click row for details)
Prime Distribution by Gap Class
Shows how many primes belong to each gap family. Twin primes (gap 2) and cousin primes (gap 4) typically have the most members, while larger gaps become progressively rarer.
Prime Count and Distribution (Click row for details)
Percentage Contribution to ζ(2) by Gap Family
Shows each gap family's contribution as a percentage of log(ζ(2)). This reveals which gap sizes are most important for building up the final value. Typically gap 1 and gap 2 (twin primes) dominate.
Contribution Percentages (Click row for details)
Convergence Error Analysis
Tracks both absolute and relative error between the cumulative product and the target π²/6. As more gap families are included, the error decreases exponentially, showing convergence.
Error Metrics by Gap
Log-Scale Product Growth Pg
Displays log(P_g) for each gap family, making it easier to compare contributions across many orders of magnitude. Since products become multiplicative in log space, this shows additive contributions to log(ζ(2)).
Logarithmic Product Analysis
Gap Ratio Analysis: Twin Prime Conjecture Evidence
Tracks Count(gap=2)/Count(gap=4) and other gap ratios. Hardy-Littlewood predicts twin primes (gap 2) and cousin primes (gap 4) have identical singular series constants, so their ratio should approach 1.0 as N→∞. Gap 6 (sexy primes) has a 2× larger constant due to the p=3 factor — so it is asymptotically twice as frequent as gap 2 or gap 4, not equal.
Gap Ratio Data
Hardy-Littlewood Conjecture B: Step-by-Step Calculations for Every Gap Family
Full derivation of the singular series S(h), the logarithmic integral li₂(x), and the predicted prime-pair count for each gap family — with every arithmetic step shown and compared against your observed data.

Part 1 — The Hardy-Littlewood Formula

Hardy & Littlewood's Conjecture B (1923): for any even integer h ≥ 2, the count of primes p ≤ x where p+h is also prime satisfies:

πh(x)  ~  S(h) · li2(x)
S(h) — The Singular Series
S(h) = 2C2 · ∏p | h, p odd prime (p−1)/(p−2)
Encodes how divisibility of h by small primes opens extra residue classes, making some gaps more probable than others.
li2(x) — The Logarithmic Integral
li2(x) = ∫2x dt / ln²(t)
The density baseline — how many prime pairs would exist if distributed purely by logarithm. S(h) scales this per gap.

Part 2 — Where Does C₂ = 0.6601618… Come From?

C₂ is the twin prime constant — an infinite Euler product over all primes p ≥ 3, measuring how residue-class constraints reduce the density of twin primes relative to a random model:

C2 = ∏p ≥ 3 p(p−2) / (p−1)²

Each factor p(p−2)/(p−1)² < 1 accounts for the fact that for a prime p, there is one forbidden residue class mod p for each element of a twin-prime pair. The infinite product converges slowly to ≈ 0.66016. Below: partial products through the first 20 primes.

Prime p p(p−2)/(p−1)² Factor value Running C₂ product % of final C₂
C₂ (full precision)
0.6601618158468695…
2·C₂ = S(2) = S(4) = S(8)
1.3203236316937390…
4·C₂ = S(6) = S(12) = S(18)
2.6406472633874780…

Part 3 — Singular Series S(h) for the First 30 Even Gaps: Full Derivation

For each gap h, we compute S(h) = 2C₂ · ∏(odd prime p | h) (p−1)/(p−2). The table below shows the factorisation of h, which odd primes divide it, each correction factor, and the final S(h). Only odd prime factors count — p=2 always divides even h but contributes no correction because 2 is already handled in the baseline C₂ Euler product.

Gap h h = 2^a × odd Odd prime factors Correction factors (p−1)/(p−2) Product S(h) = 2C₂ × product S(h)/S(2) Name
The key insight: why gap 6 is twice as common as gap 2
Gap 2: h=2, no odd prime factors → correction product = 1 → S(2) = 2C₂ ≈ 1.3203
Gap 4: h=4=2², no odd prime factors → S(4) = 2C₂ identical to gap 2
Gap 6: h=6=2×3, odd factor p=3 → correction = (3−1)/(3−2) = 2/1 = 2 → S(6) = 2 × 2C₂ = 4C₂ ≈ 2.6406

Gap 30: h=30=2×3×5, corrections: (2/1)×(4/3) = 8/3 → S(30) = (8/3)×2C₂ = 16C₂/3 ≈ 3.5209

Because 3 | 6, the pair {p, p+6} satisfies p ≡ p+6 (mod 3), so neither element is forced to be divisible by 3. This doubles admissible residue pairs. At 400M your data shows gap6/gap2 = 1.767 — converging toward the limit of 2.0.

Part 4 — The li₂(x) Expansion: Every Correction Term Analysed

The integral li₂(x)=∫dt/ln²(t) has an asymptotic expansion. Each correction term below reduces prediction error. Change x to see how the terms' magnitudes shift with your analysis range.

li₂(x) = (x/ln²x) · [ 1 + 2/ln x + 6/ln²x + 24/ln³x + 120/ln⁴x + … ]   (k-th coefficient = (k+1)!)
Terms used Formula li₂(x) value 2C₂·li₂ prediction Gain from prev term Error vs obs twins*
*Observed twin count auto-populated from your last analysis run; otherwise uses 1,507,733 (400M baseline)
Why the corrections are large at practical ranges
At x=400M, ln(x) ≈ 19.8, so the first correction 2/ln(x) ≈ 10.1% — far from negligible. The k-th term has coefficient (k+1)!, so the corrections form a divergent asymptotic series — accuracy peaks around the 4th–5th term for x in the billions, then worsens. The 4-term formula gives <0.1% error at 400M.

Part 5 — Full Gap-by-Gap H-L Prediction vs Your Observed Data

Every gap family in your analysis: S(h) derived step-by-step, li₂ prediction computed, compared against your observed count. The obs/pred ratio converges to 1.0 as x→∞.

Analysis range:
Run analysis above first
Gap h Name Odd prime factors of h S(h) S(h)/S(2) Predicted Observed Obs/Pred Error % Convergence
Run the prime analysis above to populate this table

Part 6 — Interactive: Full Arithmetic Walkthrough for Any Gap

Select any gap to see every single arithmetic step: prime factorisation of h, identifying correction primes, computing each (p−1)/(p−2) factor, building S(h), expanding li₂(x) term by term, and arriving at the final prediction.

Click "Compute Step by Step" to see the full arithmetic

Part 7 — Convergence of Count Ratios to Theoretical Limits

As x→∞, Count(gap=a)/Count(gap=b) → S(a)/S(b). This table shows current ratios from your data vs the theoretical limits, with a convergence bar showing how close you are.

Ratio Why this limit Theoretical limit Current value % of limit reached Visual
Run analysis above to populate
Custom Gap Family Comparison
Compare specific gap families you choose. Test hypotheses like "gaps divisible by 6 have more primes" or "gap 6n > gap 6n±k for all k". Select up to 10 gaps to visualize side-by-side.

Select Gaps to Compare

Enter any even numbers separated by commas. Example: 6, 12, 18, 24, 30
Comparison Statistics
Step-by-Step Gap Accumulation: ζ(2) = P0 × P2 × P4 × ...
Shows the progressive buildup of the cumulative product as each gap family is added. This table view complements the convergence chart by providing exact numerical values at each step.
Progressive Product Construction
Decimal Place Convergence Analysis: Weight Decay & Marginal Contribution
Understanding Weight Decay: As primes get larger, the factor p²/(p²-1) approaches 1.0, so later primes contribute less. For example, prime 2 contributes 4/3 = 1.333... (fixed), but prime 1,000,003 contributes ≈1.000000000004. This analysis shows which primes "lock in" each decimal place of convergence for each gap family.
Per-Prime Marginal Contribution

Composite Screenshot Export

Generate a comprehensive image combining selected charts with analysis summary and mathematical narrative

Global Export Settings

These settings apply to ALL chart exports (individual and composite)

Applies to all chart PNG exports (individual and composite screenshots)
Progressive Convergence
Gap Products
Gap Distribution
Percentage Contributions
Error Analysis
Log-Scale Products
Gap Ratio Analysis
Decimal Convergence