frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Animated Factorization (2012)

http://www.datapointed.net/visualizations/math/factorization/animated-diagrams/
284•miniBill•1y ago

Comments

chrsw•1y ago
This looks cool. Could also be a screensaver (do people still use those)?
apples_oranges•1y ago
Macs now have them again. OLED screens made them create animated login screens. (At least I think that's what happened.)
pvg•1y ago
Threads (with some explainy links) from a million and a million and a bit years ago

https://news.ycombinator.com/item?id=10776019

https://news.ycombinator.com/item?id=4788224

sherdil2022•1y ago
And definitely re-post worthy!
dang•1y ago
Thanks! Macroexpanded:

Factorizer - https://news.ycombinator.com/item?id=10776019 - Dec 2015 (30 comments)

Animated Factorisation Diagrams - https://news.ycombinator.com/item?id=4788224 - Nov 2012 (72 comments)

Animated Factorization Diagrams - https://news.ycombinator.com/item?id=4713048 - Oct 2012 (2 comments)

coolcase•1y ago
> Totally out of left field here, but I got some auditory synesthesia from watching this, especially on high speed. If any of you did as well and are interested why, it's probably the same phenomenon talked about here: https://www.newscientist.com/article/dn14459-screensaver-rev...

Second this old comment!

imurray•1y ago
Heh. I submitted it in Oct 2012. I submitted a few things back then, none got traction and I stopped bothering :-).
dang•1y ago
8 isn't large enough to overcome randomness, alas!

Edit: I actually looked through https://news.ycombinator.com/submitted?id=imurray yesterday to see if there was anything we could invite a repost of. (I do this sometimes when looking at which users were first to submit an interesting article.) I didn't see anything, but on a second look https://news.ycombinator.com/item?id=7984992 could be interesting, so you'll get an email inviting you to repost that one, if you want to :)

math_dandy•1y ago
The diagrams for powers of three form the Sierpinski triangle. Makes total sense once you see it, but I hadn't seen it until today!
robot_jesus•1y ago
Same. I loved this unique insight that the visualization provided. It definitely unlocked something in my brain for how I should think about that shape.

If anyone is curious, 6561 (3^8) is the highest pure Sierpinski available in the animation since it caps at 10K.

blueflow•1y ago
I thought this was a waiting animation and the website is broken.
kccqzy•1y ago
It would function pretty well as a waiting animation too.
nurumaik•1y ago
Waiting animation that ends after the last prime number
simojo•1y ago
it took me a few seconds before I realized that it wasn't the page loading
worldsayshi•1y ago
This is brilliant!

Now i want (to build) a drag and drop toy where i can multiply or summarize numbers that are represented in this way. To see how factors move (like boids).

Is this visualization algorithm called something? The explanation link from a previous HN post seems to be broken: http://mathlesstraveled.com/2012/10/05/factorization-diagram...

CGMthrowaway•1y ago
Kind of makes me wish that there were recognizable shapes for primes bigger 2 (pair), 3 (triangle), 4 (square) and 5 (pentagon) that didn't just look like circles. Because my favorite part about this is how you can see at a glance what the factors are. Except for primes 7 or greater I find myself cheating and looking at the top left for which prime it is.

Is there some non-regular polygon that would be more distinctly recognizable to use for 7, 11, etc?

GaggiX•1y ago
Aren't 2 (pair), 3 (triangle), 4 (square) and 5 (pentagon) also "circles" with less resolution? The visualization is just consistent.
CGMthrowaway•1y ago
Yes I dont disagree and it is elegant as is, but the way our eyes/ brain works it's much harder to ID septagon, nonagon, triacontahenagon etc at a glance. A non-regular shape would be better fit for purpose
worldsayshi•1y ago
Couldn't you draw it in a recognizable way using summation?

7 = 2*3+1

11 = (2*2+1)*2+1

etc...

ajjenkins•1y ago
This would make a cool progress bar replacement. Replace percentage with the number of dots (0-100).
tocs3•1y ago
It makes me wonder what the algorithm for arranging the dots looks like.
GrantMoyer•1y ago
1. Set var factors to the prime factors of the integer

2. Sort factors in ascending order

3. Set var diagram to a single dot

4. Foreach factor in factors

4.1. Set var diagram to factor copies of diagram aranged in a circle

tocs3•1y ago
I was thinking about triangles and squares and the answer was circles.
andrewrn•1y ago
This is very cool. It looks like you used the canvas api for this, but I had expected that you'd use D3.js since its so common for data visualizations. I am curious what your thinking was there?
pona-a•1y ago
But it's not CRUD data visualization, it's a custom animation. Why use a heavy library if the browser draws circles just fine?
andrewrn•1y ago
Honestly I don't know. I am just starting to learn these technologies. I think there's a lot of potential in combining LLM structured output with web animation technologies.

One advantage of svg is that each element has a DOM node, making interactivity trivial. (but I say this not having tried mouse targetting in canvas so maybe that's not hard)

Thanks for the insight.

aaroninsf•1y ago
I wish that all the factors were shown,

e.g. when on 12, I'd like to see both 3x4 and 2x6, with a visual indicator of when the animation is showing the different factors... maybe the whole thing shrinks and additional factorizations fill in tiles subdividing the space

Knowing the number of different factorizations is an interesting and visually presentable quality that interacts in an interesting way with the factors themselves

gus_massa•1y ago
Slightly related: If you have small kids, I recommend https://www.youtube.com/@Numberblocks that is a cartoon that has characters that are numbers made by blocks, and they split to show sum and rearrange to show the factorization. It's fun for kids and the technical part is correct.
carterschonwald•1y ago
I think this was originally invented by Brent yorgey
kccqzy•1y ago
I wish the animation could play at a slower pace so you have time to count the number of groups and the circles within each group. I also wish each time a new circle would animate from the edge of the screen and then arranged to show the addition of the new circle clearly. Otherwise, excellent visualization!
gavmor•1y ago
The jumps between neighbors are sometimes so drastic—are we sure our numbers are in the right order?
jhanschoo•1y ago
I don't know what you mean by that, but for an example, 16=2^4 and is therefore arranged as a grid, whereas 17 is prime, and must therefore be arranged as 17 dots on a circle.
gavmor•1y ago
The primes are some of the worst offenders, eg the transition from 647 (prime) to 648 (3×3×3×3×2×2×2), but as we approach infinity, the visualizations increasingly appear circular, and it's the least-primey (?) that break from the trend.

eg 854-856, & 857 (prime) are all virtually or perfectly circular. Or maybe I'm observing not mathematical but neuro-visual principles.

coolcase•1y ago
Neuro-visual I think. Hard to see 100s of dots in a circle as not a circle.

The same principle is why this looks like a circle/ellipse but it isn't:

O

gavmor•1y ago
Still, there's something to be said for the variance in the number of prime factors.

https://quickchart.io/sandbox/#%7B%22chart%22%3A%22%7B%5Cn%2...

jderick•1y ago
Can you put them all on one page and zoom in/out? Might be interesting to see some patterns in the sequence. Maybe allow filters for different factors or number ranges or different groupings.
vivzkestrel•1y ago
sliders should be added on this page that control everything. colors and speed are starters
ttoinou•1y ago
This is pure genius, congrats, and I’m disappointed at myself I didn’t think about that earlier (:
liendolucas•1y ago
This is cool! Lets use it to display the digits of a clock :-)
tocs3•1y ago
I don't know if you looked of not but here you go.

http://www.datapointed.net/2012/10/animated-factorization-di...

ape4•1y ago
I think the sum of the area of the circles should remain constant. ie be the number that's being factored.
glaucon•1y ago
Really good. I would appreciate it if it could be slowed down, or allow the numbers to be stepped through.
dtjohnnymonkey•1y ago
After some time I find myself waiting for highly composite numbers rather than primes.
smusamashah•1y ago
Does it let you put your own number and see what diagram it makes?
coolcase•1y ago
I found my new loading icon
mousethatroared•1y ago
Almost ten years ago I wanted to draw out the first thirty numbers in factored groups as shown here. It was to put in my baby daughters bedroom.

Never got around to it. This is timely, as she's factoring in school now.

hiAndrewQuinn•1y ago
This is more of a "dirty high school algebra" trick, but factoring polynomials by hand at that level got a lot easier once I realized every composite number below 100 has to be divisible by 2, 3, 5, or 7. If none of those divide it, then it's prime and you can stop factoring right there.

It similarly turns out the only "non-obvious" composite under this rule is 7*13=91, all the rest can be pretty quickly tested using the normal rules. 49 is 7², so it's similarly easy to recognize. All the others are an easy primality test.

A few randomly generated numbers to show this off:

* 31? Not divisible by 2, 3, or 5 - below 7² so no risk of 7 division either. Prime. 31=31¹.

* 69? Divisible by 3. 69 = 3*23. 23? Not divisible by 2, 3, 5 - so you can stop factoring there. 69=3¹23¹.

* 92? Divisible by 2, to 2*46 - again, divisible by 2, to 2²23 - 23 isn't divisible by 2, 3 or 5, so 92 = 2²23¹.

* 68 = 2¹34 = 2²17, and 17 is not divisible by 2, 3 or 5, so you can stop there. 2²17¹.

High school textbooks generally don't use numbers higher than 100 to preclude students who don't have calculators, so this trick came in handy many times for me. It also happens to gesture at the notion that primes are surprisingly common at low numbers, and then thin out rapidly as you climb higher and higher.

card_zero•1y ago
I assume you also know the trick of adding the columns to test divisibility by three: 387 becomes 3+8+7, which is 18, which becomes 1+8 = 9. This works because 10 % 3 = 1, so 100 = 99+1 (etc.), with the effect that each column can be counted as if it was units.

To apply the same trick to a multiple of 7, the tens column is worth 3 (10 % 7 = 3), so 91 -> 27 + 1 -> 6 + 8 -> 3 + 4 -> 7. The value is different in the next column (100 % 7 = 2). This trick is no help at all but I still like it.

(Finished editing out mistakes now.)

hiAndrewQuinn•1y ago
Hm...

14 => 1 (3^1) + 4 (3^0) => 7 => divisible by 7.

21 => 6 (3^1) + 1 (3^0) => 7 => also divisible by 7.

7 * 53 = 371 => 3 (3^2) + 7 (3^1) + 1 (3^0) => 27 + 21 + 1 => 49 => ALSO divisible by 7!

My word! This is the intuition I always suspected was possible after studying how bases worked, but I never took the time to investigate on my own.

CGMthrowaway•1y ago
Interesting idea
Liftyee•1y ago
Agree. I watched for a while to see some larger primes and was a little disappointed.

Filled polygons would offer some more shapes. Filled hexagon = 7, etc etc...

drdeca•1y ago
4 isn’t prime.

You could probably use the binary expansion to group the dots? So, 1 is • 2 is •• 3 is _• •_•

5 is

_• •_• •_•

7 is ____• _•_____• •_•___•_•

11 is ____• _•_____• •_•___•_• •_•___•_•

And so on.

(So, 2n is represented as n next to n, unless n is 2 in which case it is n above n, and 2n+1 is 1 above 2n )

Alternatively, using stars instead of n-gons could also be clearer?

tocs3•1y ago
I asked somewhere here about the algorithm for the position of the dots and got an answer (can I link directly to a post?) below. Putting things on a circle sounds like a good way to do it but it sort of precludes special arrangement for specific numbers. Not that it could not be done but what would the algorithm look like?

Edit: I looked more at the animation some more and maybe I am wrong. Anyway I may try to make one.

hhhAndrew•1y ago
In what is surely not a coincidence, 2012 is also the year in which a Stack Exchange question about how to generate these beautiful diagrams in Mathematica came up: https://mathematica.stackexchange.com/questions/11657/factor...

I wrote an answer there that produced these diagrams from fairly few lines of code.

The question there referred to same now-broken link mentioned above so the origin still unknown.

ashwinsundar•1y ago
I believe it's called prime factorization. Each number is placed in a group of numbers (or group of groups, etc...)

E.g. 24 -> 2 * 3 * 4 = Two groups of (three groups of (four items))

Also try this for the archived version of that explanation -> https://web.archive.org/web/20130206023100/http://mathlesstr...

nroets•1y ago
Note that 4 isn't prime
jhanschoo•1y ago
Most large numbers are divisible by some large prime; so suppose that a number is divisible by some large number 11. Then what appears on your screen is some pattern repeated at least 11 times arranged into a circle, because the "largest" pattern is that of the largest prime in the factorization. The numbers that can be factored into primes at most, say, 5 are comparatively very rare.
jerf•1y ago
That's the difference between the additive view of the world and the multiplicative one. A lot of number theory involves trying to bridge that gap, and even this simplest view of numbers can rapidly fling you into the mathematical unknown. The "simplest hard problem", the Collatz conjecture, can be viewed as coming from this space. You either take a step in multiplicative space, or a step in multiplicative space and then additive space, and ask a very simple question about where those steps can take you.

And that's all it takes to end up at an unsolved problem in math.

You can spend a lifetime on this simple observation that "the jumps between neighbors are so dramatic", just trying to reconcile the complex relationships between the additive view of the world and the multiplicative one.

And we haven't even done anything like bring in complex numbers, or rationals, or introduce exponentiation!

gavmor•1y ago
How can a layperson approach and develop correct intuitions for "the multiplicative view" of numbers? Is it practical?
tocs3•1y ago
I am a layperson but...

You could try writing out an addition table and a multiplication table and see if you can find patterns and differences (you can).

The Sieve of Eratosthenes is good.

I asked ChatGPT what branch of mathematics high school algebra is and it suggested the field theory of real numbers. I have since been looking at groups and fields with some enjoyment.

I made a video that I thought of as a play on Ulam's Spiral [2][3] a while back. Instead of marking primes I marked points of the (square) spiral that were x mod n 0. It is sort of silly and maybe a bit confusing.

[1] https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

[2]https://en.wikipedia.org/wiki/Ulam_spiral

https://www.youtube.com/watch?v=fRzv1SXKCY8 (my video play it slowed down maybe)

ViscountPenguin•1y ago
The best way to get a multiplicitive view of numbers is to transform multiplication into a special form of addition.

One of the more general forms of this is the logarithm. The defining equation of the logarithm is that log(a*b) = log(a) + log(b). This turns multiplication into a nice linear addition problem.

A less general but more powerful transformation exists on the integers. You can factorize any integer into it's prime factors, then multiply by adding together the powers on matching primes. This may seem like more effort for a similar result, but the prime factors of an integer tell you a lot about that integers divisibility, so it's worth the effort.

If you're talking about the interplay between multiplication and addition: Get a degree in pure maths, learn lots of number theory, and cry at how inelegant it is. Trust me, I did it in a past life

card_zero•1y ago
Hmm, no. There's a hazard of false positives here (which is why I had mistakes to fix previously). It's not all about the number 3; you don't want to multiply columns by 3², 3¹, 3⁰. Instead you want the remainder of the division of (ten to the column number) by seven (or whatever divisor you're checking).

That's a repeating pattern. In the case of 3 the pattern has length 1, and it goes (1, 1, 1, ...). In the case of 7 the pattern has length 6, and it goes (1, 3, 2, 6, 4, 5), starting at the units column. If that looks a bit pseudorandom, there's a good reason, it's vaguely similar to an old-fashioned PRNG.

(The pattern starts again with 1 in the millions column, because 142857 * 7 = 999999. Hence 2 million divided by 7 has remainder 2, 3 million divided by 7 has remainder 3, and so on.)

So 371 should be understood as 3*2 + 7*3 + 1*1, which is 28.

Or as another example, 6993 => 6*6 + 9*2 + 9*3 + 3*1, which is 84.

card_zero•1y ago
Waaait a minute though. The results for (10 to the n) % 7 and the results for (3 to the n) % 7 are the same, so your version works precisely. That's because the difference is 7.

Show HN: Aquifer – an MCP runtime for spiky agent tool traffic

https://github.com/rjpruitt16/aquifer
1•rjpruitt16•4m ago•0 comments

Show HN: Keybench – Scriptable, extensible performance tool for key value stores

https://github.com/guycipher/keybench
2•alexpadula•6m ago•0 comments

No Babies? Blame Capitalism

https://jacobin.com/2026/06/birth-rates-capitalism-socialism-germany
10•thisislife2•8m ago•1 comments

Life is too short for a slow terminal

https://mijndertstuij.nl/posts/life-is-too-short-for-a-slow-terminal/
2•ingve•10m ago•0 comments

Why Aren't We Measuring How AI Affects Humans?

https://spectrum.ieee.org/measuring-ai-societal-impact-khan
2•pseudolus•17m ago•0 comments

How to Get Ahead Startups with Indie Hacking

https://twitter.com/n0rizkitty/status/2062334836195639430
4•zkitty•19m ago•0 comments

How the body creates reliable antibodies out of biological chaos

https://www.rockefeller.edu/news/39873-germinal-center-immune-evolution/
2•hhs•20m ago•0 comments

The Long Illness Persists

https://systemsthinkingcollection.substack.com/p/the-long-illness-persists
2•InputName•22m ago•0 comments

Pfizer Bets on Weight-Loss Drugs to Power Its Next Decade

https://www.bloomberg.com/news/articles/2026-06-06/pfizer-bets-on-weight-loss-drugs-to-power-its-...
2•paulpauper•22m ago•0 comments

Raize Orion Multi-framework GRC with anchored NIS2 reporting clocks

https://raizehq.dev
2•olusmith•23m ago•0 comments

Waypoint-1.5

https://over.world/blog/waypoint-1-5
2•sshh12•24m ago•0 comments

Reed Hastings officially leaves Netflix board, Jay Hoag becomes chairman

https://variety.com/2026/tv/news/netflix-board-reed-hastings-jay-hoag-chairman-1236768093/
2•hhs•28m ago•0 comments

Tragedy of the Anticommons

https://en.wikipedia.org/wiki/Tragedy_of_the_anticommons
2•thelastgallon•29m ago•0 comments

Action Potentials for May

https://neurobiology.substack.com/p/action-potentials-for-may-c20
2•paulpauper•29m ago•0 comments

Trump Signs Executive Order for AI Testing Prior to Frontier Model Releases

https://thezvi.substack.com/p/trump-signs-executive-order-for-ai
3•paulpauper•30m ago•0 comments

Predicting Stronghold locations with Bayesian statistics (2021) [pdf]

https://github.com/Ninjabrain1/Ninjabrain-Bot/blob/main/triangulation.pdf
2•aw1621107•31m ago•0 comments

Show HN: A beautiful and local-first PDF reader for studying dense things

https://www.tryquincy.live
3•oleksg•34m ago•0 comments

Experts and superforecasters update their AI timelines

https://forecastingresearch.substack.com/p/leap-wave-8-ai-timelines
2•hhs•37m ago•0 comments

If LLMs Have Human-Like Attributes, Then So Does Age of Empires II

https://arxiv.org/abs/2605.31514
3•doener•40m ago•0 comments

Show HN: An iOS bubble level designed to calibrate away camera bump

https://apps.apple.com/us/app/bubble-level-calibrated/id6767735397
2•dfskGT•48m ago•1 comments

My Partner's Dependence on Chatbots Is Becoming a Problem

https://www.nytimes.com/2026/05/30/magazine/partner-chatbot-dependence-ethics.html
2•gk1•49m ago•0 comments

TB – super‑fast text‑only browser using Jina Reader API

https://github.com/falcga/tb
2•falcga•54m ago•1 comments

A Fully Hallucinated OS [video]

https://www.youtube.com/watch?v=z3pV6FHvcgM
2•My_Name•55m ago•0 comments

How much do amd64 microarchitecture levels help in Go?

https://lemire.me/blog/2026/06/06/how-much-do-amd64-microarchitecture-levels-help-in-go/
4•chmaynard•55m ago•0 comments

"The only cassette mechanism being made" myth BUSTED [video]

https://www.youtube.com/watch?v=dYeY4DvlFDs
2•fortran77•1h ago•0 comments

Launching internal testing for PicnicTimer – looking for early Android testers

https://picnicapps.uk
2•PicnicApps•1h ago•0 comments

Hong Kong Surpasses Switzerland as the Largest Cross-Border Wealth Hub

https://www.bcg.com/press/27may2026-hong-kong-surpasses-switzerland-largest-cross-border-wealth-hub
6•LopRabbit•1h ago•0 comments

Breaking Circular Imports in Python Without Losing Type Safety

https://www.orcaset.com/blog/breaking-circular-imports-in-python-without-losing-type-safety
4•rbanffy•1h ago•0 comments

Hong Kong Develops " First" Nasal Spray for Rapid Stroke Aid [video]

https://www.youtube.com/watch?v=WyourYqtIOA
3•nikolay•1h ago•0 comments

The Machines Making People Human Again

https://www.thefp.com/p/the-machines-making-people-human
2•mhb•1h ago•0 comments