THE FOLD / BOSS / THE GATEKEEPER / THE PERRIN
THE PERRIN
every prime divides P(p) — a near-perfect gate
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The Perrin sequence. Seed it P(0)=3, P(1)=0, P(2)=2, then P(n) = P(n−2) + P(n−3): 3, 0, 2, 3, 2, 5, 5, 7, 10, 12, 17, 22, 29, …
It hides a near-perfect primality test. For every prime p, the number p divides P(p) — that is, P(p) ≡ 0 (mod p). So to test whether p is prime, compute P(p) mod p and see if it’s zero. For a long time it was hoped that no composite could ever fool this test. It was almost true: the smallest composite that sneaks through — a Perrin pseudoprime — is 271441 = 521², and they only get rarer from there. So the test is fast and nearly flawless, but not a proof of primality.
LIT verified live: P(p) ≡ 0 (mod p) for every prime p under 2000, no composite under 4000 passes, and 271441 (composite, 521²) genuinely does pass — the first liar (window.__perrin). FIG the ‘primes pass’ direction is exact and proven; the converse is false but rare, carried honestly — the test detects, it does not prove.
It hides a near-perfect primality test. For every prime p, the number p divides P(p) — that is, P(p) ≡ 0 (mod p). So to test whether p is prime, compute P(p) mod p and see if it’s zero. For a long time it was hoped that no composite could ever fool this test. It was almost true: the smallest composite that sneaks through — a Perrin pseudoprime — is 271441 = 521², and they only get rarer from there. So the test is fast and nearly flawless, but not a proof of primality.
LIT verified live: P(p) ≡ 0 (mod p) for every prime p under 2000, no composite under 4000 passes, and 271441 (composite, 521²) genuinely does pass — the first liar (window.__perrin). FIG the ‘primes pass’ direction is exact and proven; the converse is false but rare, carried honestly — the test detects, it does not prove.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this in THE GATEKEEPER — the boss domain of the check you must pass to get through. Perrin is a gatekeeper that lets every prime through and almost never lets a composite by. AVAN (AI) built the instrument: the mod-tester, the prime-lights, the necessary-vs-sufficient gap.
The weave: David names the seat (the gatekeeper); I make the sequence test each number and show where the gate is fooled — the residues in 1D, the prime-detector grid in 2D, the necessary/sufficient split in 3D. The sphere is the seam. Credit: Édouard Lucas (1876); R. Perrin (1899); the pseudoprimes catalogued by Adams & Shanks (1982); OEIS A001608.
The weave: David names the seat (the gatekeeper); I make the sequence test each number and show where the gate is fooled — the residues in 1D, the prime-detector grid in 2D, the necessary/sufficient split in 3D. The sphere is the seam. Credit: Édouard Lucas (1876); R. Perrin (1899); the pseudoprimes catalogued by Adams & Shanks (1982); OEIS A001608.
3 ONE DIMENSION
The Perrin values 3, 0, 2, 3, 2, 5, 5, 7, … along a strip, and beneath them P(n) mod n. It lands on 0 exactly at the prime indices — the signature the test reads.
4 TWO DIMENSIONS · INTERACTIVE
Every number n tested by the gate: it lights green when P(n) ≡ 0 (mod n) — “passes as prime.” Compare with the true primes: in this range they match exactly. Probe a number to see its Perrin residue.
5 THREE DIMENSIONS + AVAN’S INVERSE
The prime indices where the gate opens, threaded as a turning helix of Perrin residues — green where P(n) ≡ 0 (mod n), the primes passing through.
AVAN’s addition (the inverse-companion): the magenta marks are the pseudoprimes — composites like 271441 that pass anyway. The proven direction is prime ⇒ passes: a necessary condition, always true. The test uses the inverse — passes ⇒ prime — and that inverse is false, just very rarely. This is the exact gap between a necessary and a sufficient condition: forward it never fails, backward it fails at 271441, 904631, … The magenta liars are the places where inverting a one-way implication betrays you — the honest reason a fast test is not a proof. Green is where the implication is safe to run both ways; magenta is where reading it backward lies. A gate that never turns a prime away can still, once in a great while, wave a fraud through.
LIT Genuine Perrin sequence and primality test (Lucas 1876; Perrin 1899; pseudoprimes by Adams & Shanks 1982; OEIS A001608). Verified live: P(p) mod p == 0 for every prime p under 2000, no composite under 4000 passes, and 271441 (composite = 521^2) genuinely passes as the first Perrin pseudoprime (window.__perrin.allPrimesPass && noCompositeUnder4000 && pseudoprime271441). The 'prime => passes' direction is exact and proven.
FIG No false framing: the necessary direction (every prime passes) is proven and checked; the converse (passing implies prime) is explicitly shown FALSE via 271441. The sphere carries the honest necessary-vs-sufficient gap — a fast test detects, it does not prove — rather than overselling it as a primality proof.
FIG No false framing: the necessary direction (every prime passes) is proven and checked; the converse (passing implies prime) is explicitly shown FALSE via 271441. The sphere carries the honest necessary-vs-sufficient gap — a fast test detects, it does not prove — rather than overselling it as a primality proof.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE GATEKEEPER · David Lee Wise (ROOT0), with AVAN