Interactive pixel visualization of Pascal's triangle divisibility patterns. Dots mark binomial coefficients divisible by a chosen modulus, revealing fractal Sierpinski-like structures for prime moduli. Adjust rows (up to 2000) and modulus, then pan and zoom to explore the pattern. WebAssembly-optimized rendering.
This simulation visualizes Pascal’s triangle with dots colored based on whether their values are divisible by a given modulus. This creates interesting fractal-like patterns, especially for prime moduli.
About This Simulation
Pascal’s triangle is a triangular array of numbers where each number is the sum of the two numbers directly above it. This simulation visualizes divisibility patterns by showing dots only where the Pascal’s triangle values are divisible by the chosen modulus.
Controls:
- Mouse/Touch: Drag to pan
- Zoom Buttons: Use “Zoom In” and “Zoom Out” buttons to control zoom level
- Keyboard: Arrow keys (or WASD) to pan, +/- to zoom
- Input Fields: Enter values directly (up to 2000 rows and modulus!)
- Smart View: Changing modulus preserves your current zoom and position
Features:
- Pixel-Perfect Rendering: Uses ImageData for ultra-fast pixel manipulation - no individual dot rendering!
- WebAssembly Optimization: Uses WebAssembly for fast computation of large Pascal triangles (2000+ rows!)
- Mobile-Optimized: Touch controls and responsive design for all devices
- Modular Arithmetic: Uses modular computation from the start to handle large triangles efficiently
- Interactive Controls: Adjust the number of rows and modulus in real-time with instant feedback
Interesting Patterns to Try:
- Modulus 2: Creates the famous Sierpinski triangle fractal
- Modulus 3: Shows a different fractal pattern with three-fold symmetry
- Prime moduli: Generally create self-similar fractal patterns
- Composite moduli: Create more complex, often less regular patterns
The patterns emerge from the properties of binomial coefficients and modular arithmetic, revealing deep mathematical structures within Pascal’s triangle.
code
(note: parameters in the code might differ from the ones in simulation results below)-
Link to code(This simulation is interactive, written in JavaScript with WebAssembly optimization, see the source code of this page at the link)