ExplorationsA fractal hiding inside the numbers from school
Pascal Modulo m
Build Pascal’s triangleDefinition: Pascal’s triangle starts with 1; each new row has 1 at both ends and adds neighbouring entries above for its interior. from a top 1, placing 1 at each edgeDefinition: An edge is a connection between two nodes in a graph. 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 Sierpiński gasketDefinition: The Sierpiński gasket is the triangular fractal left after recursively removing central triangles..
Current view: The triangle
The triangle itself, printed as numbers while they fit and drawn as cells after.
| 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.
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.
| 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 remainderDefinition: The remainder is what is left after making as many complete groups of a chosen positive integer size as possible. 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.
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 Pascal's triangleDefinition: Pascal’s triangle starts with 1; each new row has 1 at both ends and adds neighbouring entries above for its interior..
Divide each entry by 2 and keep its remainderDefinition: The remainder is what is left after making as many complete groups of a chosen positive integer size as possible.. 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 Sierpiński gasketDefinition: The Sierpiński gasket is the triangular fractal left after recursively removing central triangles., not the entire infinite fractalDefinition: A fractal has intricate structure at arbitrarily small scales, often generated by repeating a construction.. Changing the divisorDefinition: A divisor of n is an integer that divides n with no remainder. from 2 changes the remaindersDefinition: The remainder is what is left after making as many complete groups of a chosen positive integer size as possible. and the colours being compared.
Why it starts to make sense
Intuition, before any algebra
Watch what parityDefinition: Parity records whether an integer is even or odd. 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 coefficientsDefinition: A coefficient is a number or expression multiplying a chosen variable or term..
That already explains why the pattern is possible - parityDefinition: Parity records whether an integer is even or odd. is self-contained, so nothing about the enormous numbers further down can interfere with it.
It does not explain why the pattern is a fractalDefinition: A fractal has intricate structure at arbitrarily small scales, often generated by repeating a construction.. For that, notice which rows are entirely odd: 1, 3, 7, 15, 31. Each is one less than a power of twoDefinition: Here, a power of two is a number obtained by starting at one and doubling a whole number of times.. 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.
The key idea
Read the row number in binaryDefinition: Binary is a way to write numbers using only 0 and 1, with place values that double to the left.
Here is the whole thing in one sentence.
is odd exactly when the binary digitsDefinition: A bit is a binary digit, either 0 or 1. of are a subset of the binary digits of - when has a 1 nowhere that has a 0.
Try it. Row 4 is in binaryDefinition: Binary is a way to write numbers using only 0 and 1, with place values that double to the left.. The only positions whose bitsDefinition: A bit is a binary digit, either 0 or 1. 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-bitDefinition: A bit is a binary digit, either 0 or 1. 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 self-similarDefinition: A self-similar object contains smaller parts that reproduce its overall pattern after rescaling. - "fits inside" is a condition on digit strings, so it repeats every time the string gets one place longer, which is every power of 2Definition: Here, a power of two is a number obtained by starting at one and doubling a whole number of times..
Formal statement
Precisely what is being claimed
Lucas' theoremDefinition: A theorem is a mathematical statement established by a proof from accepted definitions and earlier results.. Let be primeDefinition: A prime number is an integer greater than one whose only positive divisors are one and itself., and write
with . Then
Two consequences, which are what this page draws:
- if and only if for at least one . (One such place makes a factorDefinition: A divisor of n is an integer that divides n with no remainder. .)
- Taking : the number of odd entries in row is , where counts the 1s in the binary expansionDefinition: A binary expansion expresses a number as a sum of powers of two. of .
Note carefully what is not claimed. Lucas requires primeDefinition: A prime number is an integer greater than one whose only positive divisors are one and itself.. There is no equally simple statement for compositeDefinition: A composite number is an integer greater than one with a divisor other than one and itself. moduliDefinition: The modulus is the number you divide by when keeping only the remainder., and this page does not pretend otherwise.
Proof
Complete, not a sketch
Work in . The binomial theoremDefinition: A theorem is a mathematical statement established by a proof from accepted definitions and earlier results. gives
and for the coefficientDefinition: A coefficient is a number or expression multiplying a chosen variable or term. has a factorDefinition: A divisor of n is an integer that divides n with no remainder. of in its numeratorDefinition: The numerator is the top part of a fraction, or the part before the slash. and none in its denominatorDefinition: The denominator is the bottom part of a fraction and specifies what the numerator is divided by., since is primeDefinition: A prime number is an integer greater than one whose only positive divisors are one and itself. and . So every middle term vanishes moduloDefinition: The modulo operation gives the remainder after division by a chosen positive integer. :
Raising repeatedly, . Now expand in base and split the polynomialDefinition: A polynomial is a finite sum of terms made from coefficients and variables raised to non-negative integer powers. along its digits:
Expand each factorDefinition: A divisor of n is an integer that divides n with no remainder.. The -th contributes for some . Because base- representations are unique, each exponentDefinition: A positive whole-number exponent tells you how many copies of a base to multiply together. arises from exactly one choice of digits - so collecting the coefficientDefinition: A coefficient is a number or expression multiplying a chosen variable or term. of on both sides gives
The two consequences follow directly. For the first: when , and otherwise it is a binomial coefficientDefinition: A binomial coefficient counts selections of a given size when order does not matter. of numbers smaller than , hence not divisible by the primeDefinition: A prime number is an integer greater than one whose only positive divisors are one and itself. ; a product of non-multiples of a prime is a non-multiple. For the second: at each digit factorDefinition: A divisor of n is an integer that divides n with no remainder. is or , so the entry is odd exactly when 's bitsDefinition: A bit is a binary digit, either 0 or 1. sit inside 's, and the number of such is .
This is what a proofDefinition: A proof is a finite argument showing that a conclusion follows from stated assumptions. buys you. No amount of drawing rows establishes the claim for row 1,000,000; three lines of polynomialDefinition: A polynomial is a finite sum of terms made from coefficients and variables raised to non-negative integer powers. 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.
Limits and frontier
Where this page stops being able to help
The fractalDefinition: A fractal has intricate structure at arbitrarily small scales, often generated by repeating a construction. is a limitDefinition: A limit is the value that a sequence or function approaches under a stated limiting process., and the screen is not. What this laboratory draws is a finite triangle - at most 512 rows. The Sierpiński gasketDefinition: The Sierpiński gasket is the triangular fractal left after recursively removing central triangles. is what the parityDefinition: Parity records whether an integer is even or odd. 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 proofDefinition: A proof is a finite argument showing that a conclusion follows from stated assumptions. in layer 5 is.
CompositeDefinition: A composite number is an integer greater than one with a divisor other than one and itself. moduliDefinition: The modulus is the number you divide by when keeping only the remainder. are genuinely harder, not merely untidy. Try modulus 6 and the nesting degrades visibly. That is not a rendering artefact: Lucas needs a primeDefinition: A prime number is an integer greater than one whose only positive divisors are one and itself., 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 moduloDefinition: The modulo operation gives the remainder after division by a chosen positive integer. 2 leaves 85.0% of the entries as holes and modulo 6 leaves 70.3%, and neither number is a theoremDefinition: A theorem is a mathematical statement established by a proof from accepted definitions and earlier results..
What this page is for. It is the control case in this collection. Gilbreath's left edgeDefinition: An edge is a connection between two nodes in a graph. looks every bitDefinition: A bit is a binary digit, either 0 or 1. 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 proofDefinition: A proof is a finite argument showing that a conclusion follows from stated assumptions. 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.
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
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
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
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
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.
- É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.
- 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.
- 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.
- 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.
- 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.
Related by mechanism
Connected by how they work, not by sharing a topic label.