A fast, interactive prime number grid visualizer that runs entirely in your browser.
It uses an optimized Sieve of Eratosthenes and renders numbers using an HTML <canvas> for smooth performance even at large values of n.
- 🟩 Prime — Green
- 🟥 Composite — Red
- 🔵 1 (Special) — Neither prime nor composite
- ⬜ Beyond n — Grey
https://abhrankan-chakrabarti.github.io/prime-grid-visualizer/
- Adjustable n, columns, and cell size
- Optimized Sieve of Eratosthenes in JavaScript
- Canvas-based rendering for high performance
- Hover tooltip with number + classification
- Jump to number navigation with yellow highlight flash
- Auto-centering scroll when jumping
- Compact statistics section (Prime count, Composite count, Prime %, Column-wise distribution)
- Export grid as PNG
- Works fully offline
- Clean, responsive interface
index.html # Main application
README.md # Documentation
A fast implementation of the Sieve of Eratosthenes is used to classify every number up to n:
1is treated as a special case- Primes marked in green
- Composites in red
- Numbers beyond
nin grey
The grid is drawn using <canvas>, allowing:
- Smooth panning
- Fast updates even with thousands of cells
- PNG export capability
Entering a number:
- Scrolls to its cell
- Centers it in the view
- Highlights it briefly
Useful for exploring patterns in prime distribution.
-
Go to Settings → Pages
-
Choose:
- Source: Deploy from branch
- Branch:
main - Folder:
/(root)
-
Save and open your published link.
MIT License
Abhrankan Chakrabarti
If you enjoy this visualizer, please consider leaving a star ⭐ on GitHub!
