Show HN: Prime Number Grid Visualizer

dduplex | 139 points

I spammed the columns from 1 to 402 (with 400 rows), and i saw some cool patterns. I can see a few nodes of clockwise rotation that converges into a single node from >200 columns that starts makes its way down the screen. Trippy.

I made a screen recording of it: https://n0ssc.com/wp-content/uploads/2025/08/prime-doublespe...

kawfey | 5 days ago

Reminds me of a really cool coding trick to get a "random" permutation of an array in O(1) time/memory.

https://lemire.me/blog/2017/09/18/visiting-all-values-in-an-...

brandonasuncion | 5 days ago

This is very cool, it reminds me of an ulam spiral. https://en.m.wikipedia.org/wiki/Ulam_spiral

yummypaint | 5 days ago

The trick is to do 88 columns, punch them out on a roll, and run it through a player piano.

noduerme | 4 days ago

The first thing I thought of was why not add the QR markers (i.e. the three squares) and then see if a prime grid is scannable.

Perhaps a prime grid will generate a valid QR code that is itself a prime number in QR!

Towaway69 | 21 hours ago

When choosing rows = 4000 and columns = 546, an interesting pattern emerges.

For all integers n ≥ 0, the ranges [243 + (n * 546)] to [249 + (n * 546)] inclusive appear to contain no prime numbers. Same with the ranges [297 + (n * 546)] to [303 + (n * 546)].

For both sets of ranges, the minimum gap between the closest neighbouring primes appears to be at least 10 (in decimal). Does anyone know of a number-theoretic explanation for this kind of pattern?

mfoc | 5 days ago

Someone's going to find the correct column count to reveal the hidden message to build an intergalactic space ship with FTL travel.

throwmeaway222 | 4 days ago

It'd be great to be able to plot only the primes that satisfy some simple (at first anyways) math operations. "Show me the primes that when (math operation) by (a set of values) equals (set of results). EG when (mult,div,squared) by (n1,n2...) equals (0,e^2, ...). Exploring for surprise patterns!

8bitsrule | 5 days ago

A feature Id like to see is an option to invert the grid, i.e. show the composites instead of the primes

yen223 | 4 days ago

I'm probably an idiot but having the columns at a multiple of 6 is very pleasing

navane | 5 days ago

Could be fun to turn these into initial conditions for Game of Life

rg2004 | 5 days ago

The density of prime numbers remains remarkably consistent as you increase the grid size. Even the end of a 10,000 x 10,000 grid had just as many primes per inch as the earlier numbers

hobo_in_library | 5 days ago

Reminds me of what I do when trying to look for structure in binary data. Print it to the screen in either bits or bites with word wrap enabled and drag the window around.

heywire | 4 days ago

So cool! I'd like to be able to start at any number

wordglyph | 7 days ago

There's a way to warp this in 3D and Contact two sides together to show the framework blueprint of a Portal device.

HocusLocus | 5 days ago

Ha, super, thanks for making it.

Check out 431 columns - this yields no obvious persistent patterns.

eps | 5 days ago

Add option to skip all even numbers, another to skip all numbers ending with 5. Also, a way to see the number when you click a pixel or space.

It's fun seeing all these patterns. I did some edit. I was thinking that skipping over numbers divisible by 2 and 5 will get rid of most visible gaps, but they keep emerging.

smusamashah | 5 days ago

columns = 420 has an interesting set of troughs down the sides and middle.

kentbrew | 4 days ago

cool

shankarpriyank | 3 days ago

kick miamia9423 in Roblox

dont_kill3122 | 4 days ago