math

A Curious Pattern in Pascal’s Triangle and Its Connection to Primes

A programmer’s exploration: rediscovering a classical result, validating it computationally, and seeking deeper insight from number theory.

A Curious Pattern in Pascal’s Triangle and Its Connection to Primes

Introduction

By way of context, I am not a professional mathematician. My formal mathematical training has largely been dormant over the past decade while I have worked in software development. This note is not intended to present a novel theorem, but rather to describe an observation I arrived at independently, how I explored it using simple computational tools, and where I would greatly value insight from those with deeper expertise in number theory.


The Observation

My interest in prime numbers recently led me back to Pascal’s triangle. As is well known, Pascal’s triangle encodes binomial coefficients: row n corresponds to the coefficients of the expansion of (a + b)ⁿ, and the structure has wide applications in combinatorics and probability.

Focusing specifically on the central elements of the triangle, consider the sequence of central binomial coefficients:

1, 2, 6, 20, 70, 252, 924, 3432, 12870, …

These occur in even-numbered rows. I paired each central value with the subsequent odd integer:

Central valueAssociated odd number
23
65
207
709
25211
92413
343215
1287017

Examining the division of each central value by its associated odd number produced an unexpected pattern:

  • 20 = 7 × 3 − 1
  • 252 = 11 × 23 − 1
  • 924 = 13 × 71 + 1

In each of these cases, the central value is exactly one unit away from a multiple of the associated number.

However:

  • 70 ÷ 9 leaves remainder 7
  • 3432 ÷ 15 leaves remainder 12

These are not close to ±1.

The distinguishing feature is that the “successful” cases correspond to prime numbers (3, 5, 7, 11, 13, 17), while the failures correspond to composite numbers (9, 15). This suggests:

The central binomial coefficient in row 2n is congruent to ±1 modulo 2n+1 if and only if 2n+1 is prime.


Computational Verification

To validate this observation, I implemented a simple script to test all odd numbers up to nearly 10,000.

The results were striking:

  • Every prime satisfied the condition.
  • Every composite failed, with exactly one exception: 5907.

Additionally, a refinement emerged:

  • The remainder is +1 when the row index is divisible by 4.
  • The remainder is −1 otherwise.

This yields a surprisingly simple primality test: To test whether p is prime, compute the central binomial coefficient of row p−1 and check whether it is congruent to ±1 modulo p.

Here is that script, running live in your browser. Pick any odd number up to 9,999 — the central binomial coefficient is computed exactly, in arbitrary-precision integer arithmetic:

The test, live
This interactive demo requires JavaScript.

Prior Work

Unsurprisingly, this phenomenon is well known in number theory. It is closely related to classical results connected to Fermat’s Little Theorem and properties of binomial coefficients modulo primes.

More specifically, the observation corresponds to a known congruence pattern in Pascal’s triangle: for a prime p, the entries of row p−1 alternate between +1 and −1 modulo p.

The use of the central binomial coefficient as a primality criterion was formally studied by Christian Aebi and Grant Cairns (2008). Their work connects these observations to Catalan numbers and related structures.

It is worth noting that their route to the result was the opposite of mine. Aebi and Cairns proceeded analytically: starting from Fermat’s Little Theorem and the known existence of pseudoprimes, they deliberately searched for an analogous criterion among combinatorial sequences. In my case there was no theory at the outset — only the triangle itself, and the empirical observation that the central values kept landing one unit away from a multiple exactly at the primes. Two very different paths, converging on the same congruence.


The Exceptional Case

The single composite number that passed the test in my computation was:

  • 5907 = 3 × 11 × 179

This is an example of a Catalan pseudoprime.

Here is the full scan — every odd number from 3 to 9,999, one cell each. One red cell hides among 4,999:

The full scan: 3 – 9,999
This interactive demo requires JavaScript.
the test says prime — correct for all 1,228 primes in range ·  correctly rejected composite ·  3587 — lands one away but on the wrong side; only the ±1 sign refinement rules it out ·  5907 — the impostor. Hover to inspect, click to load a number into the tester above.

Remarkably, only three such numbers are currently known:

  • 5907
  • 1194649 = 1093²
  • 12327121 = 3511²

The latter two are squares of Wieferich primes, a rare class of primes related to deep questions in number theory. Only two Wieferich primes are currently known (1093 and 3511), and it is unknown whether more exist.

Aebi and Cairns showed that squares of Wieferich primes necessarily produce Catalan pseudoprimes, establishing a direct link between this simple combinatorial observation and a long-standing open problem.


Intuition for the Result

A heuristic explanation is as follows:

  • In Pascal’s triangle, entries are given by binomial coefficients involving factorials.
  • When the row index is prime, the binomial coefficients exhibit strong divisibility properties.
  • These enforce a strict alternating pattern modulo p in the preceding row.
  • The central element must therefore be congruent to ±1 modulo p.

Composite numbers generally fail to enforce this structure, except in rare cases where their factors align in a specific way.


Questions

I would appreciate insight on the following:

  1. Search bounds: How far have Catalan pseudoprimes been searched? Are there known computational limits beyond the three examples?

  2. Heuristics: Is it plausible that additional Catalan pseudoprimes exist that are not squares of Wieferich primes?

  3. Computation: Is there an efficient method for testing large candidates without explicitly computing central binomial coefficients, which appear computationally expensive?


Closing Remarks

While this exploration did not yield a new theorem, it provided a valuable experience: independently observing a genuine mathematical pattern, validating it computationally, and discovering its connection to deep and unresolved questions.

I would welcome any corrections, clarifications, or references that could help refine my understanding further.


References

  • C. Aebi, G. Cairns (2008), Catalan numbers, primes and twin primes
  • Literature on Catalan pseudoprimes
  • Morley (1895), congruences modulo p³