r/mathpics • u/Hivvery • Jul 17 '25
The prime factorisations of 0 - 99 visualised
2 is blue, 3 is green, 5 is yellow, 7 is red, 11 is pink and the rest of the prime numbers are purple. I like how there are lots of colored stripes going along the numbers. Also, I'm sorry for getting a bit lazy at some parts, especially with the large prime numbers and their multiples.
8
u/JimmyTheWizzard Jul 17 '25
Love the 2n ’s - Reminds me of a Numberphile video on “space filling curves”.
9
u/No-Crew8804 Jul 17 '25
Nice idea, although the big primes cannot be distinguished. Maybe instead of convex polygons use stars for bigger primes?
5
u/Hivvery Jul 17 '25
That would be a great idea! Points of stars would be easier to see than flat edges :)
3
u/chidedneck Jul 18 '25
And different colors would be better for the larger primes for distinguishing them at a glance. Great job still.
2
u/Silly-Freak Jul 20 '25
I've tried to recreate this with stars for big primes: https://typst.app/project/rvJnB90GMxteAYAQT9yq9h
It's not as pretty (no randomness in the rotations and sizes to make it more natural) but still wanted to share!
10
u/hymie0 Jul 17 '25
As the husband of a math teacher, I could easily imagine a high-quality version of this as a poster on the wall of a math classroom.
4
2
u/lilbirbbopeepin Jul 17 '25
how would one code something like this?
1
u/Brainsonastick Jul 17 '25
This looks to be done by hand but coding it shouldn’t be too hard. Recursion will be the neatest way to do it.
Draw(n, x, y):
0) if n is 0 or 1, stop
1) Take the prime factorization of n (plenty of ways to code finding that).
2) Take the largest prime factor, p_1, and draw a regular polygon with that many sides. Then draw a regular polygon with p_1 sides with center (x,y)
3) iterate over the corners of that polygon (with coordinates (x_i, y_i) and call draw(n/p_1, x_i, y_i).
You’ll have to handle the dot for 1 separately but that’s easy enough. You may want to specify that the polygon drawn has a side orthogonal to the line from the previous polygon center to the center of the new one, as seems to be done here. Then you’d just add a new parameter to the function. Either the old coordinates or an angle.
1
u/Brainsonastick Jul 17 '25
Oops, I meant to reply to your comment directly but accidentally replied to the post. here is how to code it
1
u/Silly-Freak Jul 20 '25
If you're interested, here is one implementation: https://typst.app/project/rvJnB90GMxteAYAQT9yq9h
It's not as pretty - no randomness in the rotations and sizes to make it more natural - but that could be fixed if I bothered enough :P
1
u/i-love-vinegar Jul 17 '25
I really like this! You should make it in higher quality and change colours for the primes above 11 that would be cool!
1
12
u/No-Crew8804 Jul 17 '25
Nice idea, although the big primes cannot be distinguished.