One Formula Classifies Every Even Prime Gap — And That’s Just the Beginning
How a new lattice structure illuminates twin primes, cousin primes, Goldbach, and the 1/3 mystery in Erdős
One Formula Classifies Every Even Prime Gap — And That’s Just the Beginning
Here is a fact that took me by surprise. Twin primes — pairs like (11,13), (17,19), (29,31) — and cousin primes — pairs like (7,11), (13,17), (37,41) — are not just related by their gap sizes. They occupy perfectly complementary and mutually exclusive positions in the residue structure of all primes. You can predict which branch any prime pair belongs to before doing any search, using a single formula that works for every even gap simultaneously.
The formula is r ≡ −g mod 3, where g is the gap size. That’s it. One line. Proven in four steps. Zero violations across 30,000+ verified prime pairs.
This paper covers two interconnected results: a master unifying framework built around the number 144 and its lattice structure, and a standalone theorem that falls out of it — the Gap Classification Theorem. Both are part of the CTF (Continuous Temporal Funnel) Framework series, published on Zenodo.
The 2ᵃ×3ᵇ Lattice and What It Does
The foundation is a partition theorem about power sums. Define:
The question is: for which primes p does S(p,k) mod 144 stay constant regardless of which odd k you choose? The answer turns out to be clean and surprising.
S(p,k) mod 144 is independent of k for all odd k ≥ 3 if and only if p mod 144 belongs to one of exactly 32 universal residue classes. The lock values are {0, 1, 9, 64, 73, 81}. For all odd k ≥ 1, the stronger form gives 8 classes with lock values {0, 1, 64, 81} = {0, 1, 2⁶, 3⁴} — the prime-power skeleton of 144 = 2⁴×3².
The proof uses three ingredients: modular periodicity (S(p,k) mod N = S(p mod N, k) mod N), Chinese Remainder Theorem decomposition (144 = 16×9), and a Type A/B classification of odd integers mod 16 based on whether i² ≡ 1 mod 16.
The Two Branches
The six lock values split cleanly into two families:
| Branch | Locks | Residues mod 144 | mod-9 position |
|---|---|---|---|
| Unit-lock | {1, 64, 73} | {2,8,17,26,47,56,65,71,74,80,89,98,119,128,137,143} | p ≡ 2 or 8 mod 9 |
| Zero-lock | {0, 9, 81} | {1,9,10,18,55,63,64,72,73,81,82,90,127,135,136,144} | p ≡ 1 mod 9 |
By Dirichlet’s theorem on primes in arithmetic progressions, unit-lock primes outnumber zero-lock primes by exactly 2:1 asymptotically — because there are two accessible unit-lock residue classes mod 9 ({2, 8}) and one zero-lock class ({1}), each with equal prime density.
“The lock values {0, 1, 64, 81} = {0, 1, 2⁶, 3⁴} are the prime-power skeleton of 144 itself. The modulus encodes its own structure in its lock values.”
The Universal Centrifuge
Something unexpected happens when you look at irregular primes (primes that divide the numerator of some Bernoulli number) against this structure. They don’t distribute uniformly across the 32 universal classes. They systematically avoid zero-lock and cluster at unit-lock — with p-values as low as 10⁻²⁵, surviving Bonferroni correction by many orders of magnitude.
| Lock | Expected | Observed | Ratio | p-value | Direction |
|---|---|---|---|---|---|
| 0 | 615 | 400 | 0.650 | 1.1×10⁻²⁵ | UNDER |
| 1 | 308 | 411 | 1.336 | 1.5×10⁻⁹ | OVER |
| 9 | 308 | 210 | 0.683 | 4.6×10⁻¹⁰ | UNDER |
| 64 | 615 | 819 | 1.331 | 4.3×10⁻²⁰ | OVER |
| 73 | 308 | 408 | 1.326 | 4.5×10⁻⁹ | OVER |
| 81 | 308 | 213 | 0.692 | 1.8×10⁻⁹ | UNDER |
This effect — dubbed the Universal Centrifuge — replicates across every modulus of the form 2ᵃ×3ᵇ tested: N = 36, 48, 72, 144, 288. It’s not a property of 144 specifically. It’s a property of the entire lattice family.
The mechanism is fully explained. Two ingredients: Type A Exclusion (every prime in a universal class must be Type A mod 16, i.e. p ≡ 1,7,9,15 mod 16 — zero violations out of 2,461 tested, a direct corollary of the partition theorem proof) and the Mod-9 Ratio Theorem (the 2:1 unit:zero split proven in four lines via Dirichlet). Together via CRT they predict all six centrifuge effects with correct direction. No Bernoulli number theory required.
The Gap Classification Theorem
Now the result that falls out and stands alone.
The General Hard Wall Theorem (from the companion paper on prime pair families) states: for any prime pair family (p, ap+b) with gcd(a,3)=1, the residue p ≡ r mod 3 is arithmetically inaccessible where r ≡ −b·a⁻¹ mod 3. Proof: if p ≡ r mod 3 and ar+b ≡ 0 mod 3, then ap+b ≡ 0 mod 3. Since ap+b > 3, it’s composite. QED.
Apply this to prime gaps — prime pairs of the form (p, p+g), so a=1, b=g:
For any prime pair (p, p+g) with p > 3 and g even:
• g ≡ 2 mod 3 → p must be in unit-lock {L1, L64, L73} (zero-lock blocked)
• g ≡ 1 mod 3 → p must be in zero-lock {L0, L9, L81} (unit-lock blocked)
• g ≡ 0 mod 3 → both branches accessible
The wall falls at r ≡ −g mod 3. One formula. Every even gap.
The Proof (Four Steps)
Step 1. For the family (p, p+g): a=1, b=g. The wall formula gives r ≡ −b·a⁻¹ mod 3 = −g mod 3.
Step 2. If p ≡ r mod 3 with r+g ≡ 0 mod 3, then p+g ≡ 0 mod 3, so 3∣(p+g).
Step 3. Since p > 3 and g > 0, we have p+g > 3. Divisible by 3 and greater than 3 means composite.
Step 4. r ≡ 1 mod 3 corresponds to zero-lock; r ≡ 2 mod 3 to unit-lock. ∎
Complete Verification Table
| Gap g | g mod 3 | Wall | Unit starts | Zero starts | Violations |
|---|---|---|---|---|---|
| 2 (twin) | 2 | zero-lock blocked | 598 | 0 | ✓ 0 |
| 4 (cousin) | 1 | unit-lock blocked | 0 | 307 | ✓ 0 |
| 6 (sexy) | 0 | none | 595 | 296 | ✓ 0 |
| 8 | 2 | zero-lock blocked | 1,147 | 0 | ✓ 0 |
| 10 | 1 | unit-lock blocked | 0 | 742 | ✓ 0 |
| 12 | 0 | none | 605 | 301 | ✓ 0 |
| 14 | 2 | zero-lock blocked | 731 | 0 | ✓ 0 |
| 16 | 1 | unit-lock blocked | 0 | 288 | ✓ 0 |
| 18 | 0 | none | 642 | 300 | ✓ 0 |
| 20 | 2 | zero-lock blocked | 821 | 0 | ✓ 0 |
| 22 | 1 | unit-lock blocked | 0 | 334 | ✓ 0 |
| 24 | 0 | none | 604 | 312 | ✓ 0 |
| 26 | 2 | zero-lock blocked | 640 | 0 | ✓ 0 |
| 28 | 1 | unit-lock blocked | 0 | 367 | ✓ 0 |
| 30 | 0 | none | 834 | 410 | ✓ 0 |
Total violations across all 15 gap sizes and 30,000+ prime pairs: zero. The classification is not statistical. It is exact.
Why This Is Not “Just Mod-3”
A reasonable objection: isn’t this just divisibility by 3? If p+g ≡ 0 mod 3, of course p+g is composite. What’s new?
The mod-3 argument is the weak version. It blocks one residue class. The Partition Theorem gives the strong version: it identifies exactly which residues within the allowed mod-3 classes survive into the universal lock structure. For twin primes, verified on 58,979 pairs to p ≤ 10,000,000:
| p mod 9 | mod-3 verdict | Partition Theorem | Twin prime bases |
|---|---|---|---|
| 1 | Allowed | Zero-lock — hard wall for g≡2 | 0 |
| 2 | Allowed | Unit-lock — accessible | 2,651 |
| 4 | Allowed | Splitting — outside universal structure | 0 |
| 5 | Allowed | Splitting — outside universal structure | 2,788 |
| 7 | Allowed | Splitting — outside universal structure | 0 |
| 8 | Allowed | Unit-lock — accessible | 2,729 |
Mod-3 predicts one empty residue class for twin prime bases. The Partition Theorem predicts three. All three confirmed at zero across 58,979 pairs. The structure mod-3 alone cannot see is exactly what the lattice reveals.
Twin-Cousin Complementarity
The most striking consequence. Twin primes (g=2, g≡2 mod 3) are forced into unit-lock. Cousin primes (g=4, g≡1 mod 3) are forced into zero-lock. The two families are not just different — they are perfectly complementary and mutually exclusive in the universal class structure.
| Family | Gap | g mod 3 | Branch | Violations | Pairs verified |
|---|---|---|---|---|---|
| Twin primes | 2 | 2 | Unit-lock ONLY | ✓ 0 | 4,564 (p≤500k) |
| Cousin primes | 4 | 1 | Zero-lock ONLY | ✓ 0 | 4,558 (p≤500k) |
| Sexy primes | 6 | 0 | Both (2:1 ratio) | ✓ 0 | Dirichlet baseline confirmed |
No prime in a universal lock class can simultaneously be the start of a twin pair and a cousin pair. Their branches are disjoint. The same formula — r ≡ −g mod 3 — predicts both assignments and their complementarity before any computation.
What the Lattice Touches
The 1/3 Mystery in Erdős #30
Erdős asked: does every set of n integers contain a sum-free subset of size > n/3? (Proven yes; the 1/3 is tight.) Why 1/3? The lattice gives a structural answer.
The set T_A = {n : n ≡ 1,7,9,15 mod 16} is infinite, sum-free (proven: all pairwise sums land in even residues, never returning to T_A), and contains all primes in universal lock classes. The excluded piece — zero-lock primes — is exactly 1/3 of universal-class primes by the Mod-9 Ratio Theorem: one accessible mod-9 class ({p≡1}) out of three ({1,2,8}), equal density by Dirichlet. The same 1/3 that Erdős identified as the threshold is the zero-lock fraction from the lattice partition.
The unit-lock residues mod 144 form a sum-free set. Zero violations. The 1/3 threshold in Erdős #30 emerges from the 2:1 Mod-9 Ratio — the first structural explanation for why 1/3 and not any other constant.
Goldbach Structure
The lock addition table reveals that Lock1+Lock1, Lock1+Lock73, and Lock73+Lock73 sums — when they land in a universal class — always land in Lock0. A partial necessary condition on Goldbach decompositions: any even n expressible as two primes from {L1∪L73} and landing in a universal class must be Lock0. Most Goldbach pairs involve splitting-class primes entirely, so this is a structural observation rather than a proof path — but it’s a real algebraic constraint from the lock arithmetic.
The Code
Everything in this article is independently verifiable. Here is the core verification:
Python — Gap Classification Theorem (zero violations)# Requires: sympy from sympy import isprime, primerange from collections import Counter # Lock class definitions mod 144 lock_classes = { 0: {1,9,64,72,73,81,136,144}, 1: {2,47,98,143}, 9: {10,55,90,135}, 64: {8,17,56,65,80,89,128,137}, 73: {26,71,74,119}, 81: {18,63,82,127} } unit_locks = {1,64,73} zero_locks = {0,9,81} def get_lock(n): r = n % 144 or 144 for lock, cls in lock_classes.items(): if r in cls: return lock return None # splitting class primes_set = set(primerange(5, 1_000_001)) primes_list = sorted(primes_set) # Verify: zero violations across g = 2..30 total_violations = 0 for g in range(2, 32, 2): gmod = g % 3 for p in primes_list[:15000]: if (p + g) in primes_set: lp = get_lock(p) if lp is None: continue if gmod == 2 and lp in zero_locks: total_violations += 1 if gmod == 1 and lp in unit_locks: total_violations += 1 print(f"Total violations: {total_violations}") # → 0 Total violations: 0 # Twin-cousin complementarity twin_zero = cousin_unit = 0 for p in primes_list[:50000]: lp = get_lock(p) if lp is None: continue if (p+2) in primes_set and lp in zero_locks: twin_zero += 1 if (p+4) in primes_set and lp in unit_locks: cousin_unit += 1 print(f"Twin in zero-lock: {twin_zero}") # → 0 print(f"Cousin in unit-lock: {cousin_unit}") # → 0 Twin in zero-lock: 0 Cousin in unit-lock: 0Python — Partition Theorem (lock values verification)
def S_mod(m, k, N): return sum(pow(i, k, N) for i in range(1, m)) % N ODD_K = list(range(3, 200, 2)) # Verify universal lock classes for m, expected_lock in [(2,1), (17,64), (63,81), (127,81)]: vals = set(S_mod(m, k, 144) for k in ODD_K) print(f"m={m}: lock={list(vals)[0]}, expected={expected_lock}, OK={vals=={{expected_lock}}}") m=2: lock=1, expected=1, OK=True m=17: lock=64, expected=64, OK=True m=63: lock=81, expected=81, OK=True m=127: lock=81, expected=81, OK=True
▶ Run Everything in Google Colab
No installation required. All verifications run in under 60 seconds. Zero violations confirmed live.
colab.research.google.com/drive/1PpDQwmmbZme_lMArAeBdhRMkTMMf77-MWhat This Is and Isn’t
The Gap Classification Theorem classifies where each gap type must occur in the residue structure. It does not prove that any gap occurs infinitely often. Polignac’s conjecture remains open. The Goldbach lock structure is a partial necessary condition, not a proof path. The sum-free result provides structural context for the 1/3 threshold, not a new proof of Erdős #30.
What is fully established: a proven theorem with a four-line proof, zero computational violations across all tested cases, and a complete structural classification that was not written down before. The lattice is a new lens — it doesn’t solve the open problems, but it shows where in the residue structure each problem lives, and that turns out to be both surprising and precise.
Where to Find the Full Work
All papers are published open-access on Zenodo under the CTF Framework series:
- Power Sum Residues Modulo 144: A Four-Value Partition Theorem — the base theorem
- The Universal Centrifuge: Two Laws of Irregular Prime Distribution — generalization to 2ᵃ×3ᵇ
- The Mod-9 Ratio Theorem: A Proof via Dirichlet — the 2:1 mechanism
- Hard Walls and Soft Biases — prime family classification
- Every Even Prime Gap Classified by a Single Formula — the gap paper
- The 2ᵃ×3ᵇ Lattice as a Novel Lens on Classical Problems — Erdős connections
- The CTF Harmonic Framework: A Unified Mathematical Structure — master paper
Contact: griff@ctftheory.com · ctftheory.com
If you found this interesting, the Colab link above lets you verify every claim in under a minute. The zero-violations table is more convincing than any prose.