ExplorationsA fractal hiding inside the numbers from school

Pascal Modulo m

Provedbinomial coefficientsmodular arithmeticfractalscurious

Build from a top 1, placing 1 at each of a new row and adding neighbouring entries to fill the inside. Colour odd entries and leave even ones blank: the row 1, 2, 1 becomes coloured, blank, coloured. As you add rows, repeated triangular gaps form larger finite pieces of the .

Current view: The triangle

The triangle itself, printed as numbers while they fit and drawn as cells after.

The triangle · modulo 2 · 8 rowsnothing reduced yet
Row 0
Row 1
Row 2
Row 3
Row 4
Row 5
Row 6
Row 7
entry
one number of the triangle, printed
working
the two numbers above that were added to make it
row
one line of the triangle; row n has n + 1 entries

Each row is one line of the triangle, and row n has n + 1 entries. At the smallest sizes every entry is printed with the arithmetic that made it; past sixteen rows they become squares, filled where the entry survives division and blank where it does not. The blanks are the holes, and they are the whole picture.

8 rows of ordinary Pascal's triangle. Nothing has been reduced yet - every entry is the sum of the two above it.

Modulus
2 · prime
Rows
8
Holes
none yet

Build it up

The coefficients and the additions that produce them are shown before anything is reduced.

Begin with eight printed rows, where every addition can be checked. Each larger rung keeps that same rule and adds enough rows for the pattern to emerge.

Modulus

2 is prime, so Lucas’ theorem applies and the holes nest inside larger holes at every power of 2.

Cases worth seeing

Try this

Row 12 is 1100 in binary. Without drawing it, how many of its entries are odd? Then check in the Counting view.

1/3

What is going on

Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.

Worked by handNine rows of with every entry halved and the kept. The is printed above the remainder it leaves.
Row 0
11
Row 1
1111
Row 2
112011
Row 3
11313111
Row 4
1140604011
Row 5
11511001005111
Row 6
11601512001516011
Row 7
11712113513512117111
Row 8
11802805607005602808011

Now draw a filled square wherever the is 1 and leave it blank wherever it is 0. Nine rows give the shape above; two hundred and fifty-six give the picture in the laboratory. Nothing else is done to it.

Row 7 came out entirely odd - 1, 7, 21, 35, 35, 21, 7, 1, not one of them even - and row 8 collapsed to a 1 at each end with seven zeroes between. Those two rows next to each other are the gasket in miniature: a solid base, and directly beneath it almost nothing. It happens again at rows 15 and 16, and at 31 and 32, and it never stops happening.

01

What you are seeing

A plain description of the process

Place a 1 at the top of a triangle. Each new row begins and ends with 1; every inside entry is the sum of the two entries immediately above it. This gives the rows 1; 1, 1; 1, 2, 1; and 1, 3, 3, 1, the beginning of .

Divide each entry by 2 and keep its . An even entry leaves 0 and an odd entry leaves 1, so 1, 2, 1 becomes 1, 0, 1. Colour the 1s and leave the 0s blank.

As the triangle grows, repeated triangular gaps appear. Each displayed triangle is a finite stage of the pattern associated with the , not the entire infinite . Changing the from 2 changes the and the colours being compared.

02

Why it starts to make sense

Intuition, before any algebra

Watch what does to the addition rule. Odd + odd is even; odd + even is odd; even + even is even. So the parity of an entry depends only on the parities above it, and the triangle of 0s and 1s builds itself without ever consulting the actual .

That already explains why the pattern is possible - is self-contained, so nothing about the enormous numbers further down can interfere with it.

It does not explain why the pattern is a . For that, notice which rows are entirely odd: 1, 3, 7, 15, 31. Each is one less than a . A full row of 1s means the row beneath it is all 0s except at its ends - every interior entry is odd + odd - so a solid base is always followed by an empty row. And the structure that was built above that base then repeats, at twice the size, below it.

Solid rows at 2ᵏ − 1, doubling each time, is the gasket's construction, arrived at from the other direction.

03

The key idea

Read the row number in

Here is the whole thing in one sentence.

is odd exactly when the of are a subset of the binary digits of - when has a 1 nowhere that has a 0.

Try it. Row 4 is in . The only positions whose fit inside are and - that is and - so row 4 has exactly two odd entries, and indeed 1, 4, 6, 4, 1 is odd, even, even, even, odd.

Row 7 is . Every three- number fits inside , so every entry of row 7 is odd. All eight of them.

This is why the count of odd entries in row is , where is the number of 1s in : a set of elements has exactly subsets. And it is why the pattern is - "fits inside" is a condition on digit strings, so it repeats every time the string gets one place longer, which is every .

04

Formal statement

Precisely what is being claimed

Lucas' . Let be , and write

with . Then

Two consequences, which are what this page draws:

  1. if and only if for at least one . (One such place makes a .)
  2. Taking : the number of odd entries in row is , where counts the 1s in the of .

Note carefully what is not claimed. Lucas requires . There is no equally simple statement for , and this page does not pretend otherwise.

05

Proof

Complete, not a sketch

Work in . The binomial gives

and for the has a of in its and none in its , since is and . So every middle term vanishes :

Raising repeatedly, . Now expand in base and split the along its digits:

Expand each . The -th contributes for some . Because base- representations are unique, each arises from exactly one choice of digits - so collecting the of on both sides gives

The two consequences follow directly. For the first: when , and otherwise it is a of numbers smaller than , hence not divisible by the ; a product of non-multiples of a prime is a non-multiple. For the second: at each digit is or , so the entry is odd exactly when 's sit inside 's, and the number of such is .

This is what a buys you. No amount of drawing rows establishes the claim for row 1,000,000; three lines of algebra establish it for every row at once. Every other exploration in this guide is missing exactly this, and it is worth feeling the difference.

06

Limits and frontier

Where this page stops being able to help

The is a , and the screen is not. What this laboratory draws is a finite triangle - at most 512 rows. The is what the pattern approaches when the drawing is scaled to a fixed size and the number of rows grows without bound. Every finite picture here is an approximation to it, and the resemblance at 256 rows is not evidence for the limit; the in layer 5 is.

are genuinely harder, not merely untidy. Try modulus 6 and the nesting degrades visibly. That is not a rendering artefact: Lucas needs a , and there is no comparably simple digit criterion for a composite. The general theory - Kummer's carry-counting result, and the extensions to prime powers - is real mathematics and substantially more involved than anything above. The claim on this page about composites is deliberately marked observed rather than proved, and its scope names the 512 rows it was measured over: at that size 2 leaves 85.0% of the entries as holes and modulo 6 leaves 70.3%, and neither number is a .

What this page is for. It is the control case in this collection. Gilbreath's left looks every as convincing as the gasket does and remains an open problem; the happy numbers are settled, but by exhausting a finite space rather than by an argument. Here the picture and the are the same object, and holding all three in mind is the most useful thing this guide can give you - because from the outside, a pattern with a proof behind it and a pattern without one look exactly alike.

What is actually established

Every statement on this page, with its status, its exact scope, and the date that status was last checked.

Proved

For a prime p, C(n, k) mod p is the product over base-p digit places of C(nᵢ, kᵢ) mod p.

Scope
All non-negative integers n and k, and all primes p.
Why
Lucas’ theorem, 1878. The usual proof compares coefficients in (1 + x)ⁿ modulo p, where (1 + x)^p ≡ 1 + x^p, so the polynomial factors along the base-p digits of n and the coefficient of x^k factors with it.
Status checked
Proved

C(n, k) is divisible by a prime p exactly when some base-p digit of k exceeds the matching digit of n.

Scope
All non-negative integers n and k with k ≤ n, and all primes p.
Why
Immediate from Lucas: a digit place with kᵢ > nᵢ contributes C(nᵢ, kᵢ) = 0, and a product with a zero factor is zero. Conversely, if every kᵢ ≤ nᵢ then every factor is a binomial coefficient of numbers below p, so none is divisible by p and neither is the product. This is the statement the picture is a picture of.
Status checked
Proved

The number of odd entries in row n of Pascal’s triangle is 2 raised to the number of 1s in the binary expansion of n.

Scope
Every row n ≥ 0.
Why
Lucas at p = 2: the entry C(n, k) is odd exactly when every binary digit of k is at most the matching digit of n - that is, when k’s bits are a subset of n’s. A set with r elements has 2ʳ subsets.
Status checked
Proved

Scaled to a fixed size, the parity triangle converges to the Sierpiński gasket as the number of rows grows.

Scope
The limit of the parity pattern under repeated halving; not a statement about any finite drawing.
Why
The subset condition above is self-similar under doubling: the odd entries of the first 2ᵏ rows repeat, in three copies, in the first 2ᵏ⁺¹. That is exactly the gasket’s construction. What is on screen here is always a finite approximation - the fractal is the limit, and no drawing is it.
Status checked
Observed in this run

For a composite modulus the pattern is coarser and does not nest in the same way.

Scope
The moduli this laboratory offers, drawn to at most 512 rows. At 512 rows modulo 2 leaves 85.0% of entries as holes, and modulo 6 leaves 70.3%.
Why
Deliberately not stated as a theorem. Lucas needs a prime, and the extensions that handle prime powers and composites are substantially more complicated - so the honest statement here is about what this page draws, not about all moduli. Granville’s survey is where the general case lives.
Computation (exact)
Exact integer arithmetic in remainders, over the first 512 rows - 131,328 entries - computed in your browser and cross-checked in the test suite against Lucas’ theorem evaluated independently for every prime modulus on offer. Algorithm pascal-1.
Status checked

Sources

Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.

  1. Édouard Lucas, Théorie des fonctions numériques simplement périodiques, American Journal of Mathematics 1, 1878. Link

    The classical reference for the digit-by-digit congruence for binomial coefficients modulo a prime.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Journal archive identifies Lucas, title and 1878 publication.

  2. Ernst Kummer, Über die Ergänzungssätze zu den allgemeinen Reciprocitätsgesetzen, Journal für die reine und angewandte Mathematik 44, pp. 93–146, 1852. Link

    The companion result: the exact power of p dividing C(n, k) is the number of carries when k and n − k are added in base p. It explains the same holes from the other side, and is the sharper statement of the two.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: publisher record.

    Publisher distinguishes the 1852 issue from the 2009 digitisation date.

  3. Andrew Granville, Arithmetic properties of binomial coefficients, Organic Mathematics (CMS Conference Proceedings 20), 1997. Link

    A survey of what is known about binomial coefficients modulo prime powers, including the extensions of Lucas that composite moduli need. Cited here for the boundary of the clean statement rather than for the clean statement itself.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    University-hosted proceedings article confirms author and title.

  4. A047999 - Sierpiński’s gasket: Pascal’s triangle mod 2, The On-Line Encyclopedia of Integer Sequences. Link

    The parity triangle as a sequence, with references. Used to check the first rows of the field built here against a published listing.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    Checked the sequence identifier, definition and displayed initial terms on the database entry.

  5. A001316 - Gould’s sequence: number of odd entries in row n of Pascal’s triangle, The On-Line Encyclopedia of Integer Sequences. Link

    The count this page predicts and then verifies: 2 raised to the number of 1 bits in n. The test suite checks 200 rows against the closed form.

    Bibliographic record checked. This is not an independent verification of the proof.

    Bibliographic review:

    AI-assisted bibliographic audit. Evidence type: source text.

    Checked the sequence identifier, definition and displayed initial terms on the database entry.

Connected by how they work, not by sharing a topic label.