Pascal’s Triangle mod n illustration

Pascal’s Triangle mod n

Pascal’s triangle is built by adding the two numbers above each entry. Colour each entry by its remainder modulo n and deep structure appears: mod 2 the odd entries draw the Sierpinski triangle, and other moduli give their own nested fractal patterns. This tool renders many rows of the triangle coloured by remainder, with a slider for the modulus and the row count, so you can watch the self-similar patterns grow and connect binomial coefficients to fractals through Kummer’s and Lucas’s theorems.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • An entry is divisible by a prime p when Lucas’ theorem says one of its base-p digits exceeds the row’s — those zeros carve out the holes.
  • Modulo 2 the pattern is exactly the Sierpinski triangle, a fractal of odd binomial coefficients.
  • Prime moduli give the cleanest self-similar patterns; composite moduli mix several together.
  • Runs 100% in your browser — simulations are computed locally on your device.