Factorization diagrams

This page collects information and links about factorization diagrams, as seen on Hacker News and the cover of Hacker Monthly #31.


The basic idea is to draw n dots using a recursive layout based on the prime factorization of n—for example, 30 = 2 \times 3 \times 5 can be drawn as two groups of three groups of five dots, like this:

A full explanation can be found starting here and continuing here.

Factorization diagram cards!

Factorization diagram cards are now here! You can purchase a print-on-demand deck from The Game Crafter for $13.99. I am selling them basically at cost; the moderately high price reflects the high quality of the cards and the fact that they are print-on-demand, so there are no economy of scale effects. If you are a game/educational publisher, or know one, who would be interested in publishing this deck and making it available at a lower price, please contact me!

Each deck contains 54 large (3.5“), high-quality square cards with a linen texture and UV coating to reduce glare. The front of each card has a diagram, and the back has the corresponding number and factorization. Numbers with multiple distinct prime factors have multiple cards with different diagrams, one for each distinct permutation of the prime factors.

  • Let me know if you would be interested in a deck with the numbers 31-60!
  • Here are a few suggested games you can play with the cards, from a middle school classroom.
  • If you use them in a classroom and come up with a fun activity/game/puzzle using the cards, please let me know! I would like to collect a big list of suggested activities for different ages and eventually be able to publish the list along with the cards.

The images used to make the cards are freely available here, and the source code is on github. Everything is released under a Creative Commons Attribution 3.0 license.

Let me know if you would be interested in a different downloadable format, e.g. a PDF with four cards per page, for easier printing and cutting out. I may get around to making such a thing eventually.

You can read about the redesigned version of the cards here. And here is the video from when I got the first printing of the first version of the cards. The colors and design are now a bit different, but it should give you a sense for the size and quality of the cards:


You can now buy high-quality, printed-on-demand factorization diagram posters from imagekind! The print quality is fantastic, and you can choose from a wide range of sizes, paper types, and even (if you like) frames. I think 32"x20" is the ideal size ($26 on matte paper); 24"x15" ($17) might be reasonable too though at that size it gets hard to see the finest detail. Of course you can also go bigger; 48"x31" ($44) could be a good size for a classroom, common area, or something like that.

Here’s a link to the source code for the poster as well as a high-resolution PNG (6000×9405, 4MB). The source code and image are both licensed under a Creative Commons Attribution 3.0 license, so feel free to modify the code as you like (see below), download the image and print your own poster if you have access to a high-quality large-format printer, and so on.

Make your own!

All the factorization diagram images are generated using diagrams, a domain-specific language for vector graphics embedded in Haskell. Generating factorization diagrams can be accomplished using the Diagrams.TwoD.Factorization module from the diagrams-contrib package; the source code can be found here.

Some of my original inspirations were Sondra Eklund’s awesome prime factorization sweater and blanket and also Richard Evan Schwartz’s fun book, You Can Count on Monsters.

Here’s a complete list of blog posts I have published related to factorization diagrams:

And here’s a list of stuff that other people were inspired to make (if you know of something that should be on this list but isn’t, please let me know!):


Creative Commons License
Factorization diagrams by Brent Yorgey are licensed under a Creative Commons Attribution 3.0 Unported License.

The source code for this page and other things related to factorization diagrams can be found on github.

11 Responses to Factorization diagrams

  1. Bob Woodley says:

    As the father of a 6 year old, I’ve found they are a great way to introduce the concepts of primes and factorization.

    Since then, I dabbled with the javascript animations by Sean Seefried to create 2 related products:
    1. a calculator, and
    2. a factorization game.

    More here: rwoodley.org/?p=492

  2. lynnette-net says:

    Hi! This is a good piece. I referenced it in my blog at http://quarbby.wordpress.com/2014/05/15/factorization-diagrams-by-mathlesstravelled/. I hope I didn’t infringe on any rights. Thanks for sharing!

  3. Richard Smart says:

    Love the factorisation diagram. As mentioned above this is a great way to introduce youngsters to numbers – which is precisely what I’m looking to do too.

  4. It’s very good math-art work!!! Thanks!

  5. Daniel Scher says:

    Great work! Your diagrams inspired me to create interactive, build-it-yourself versions that are similar but not the same as what you’ve done here. Have a look: http://wp.me/p1dfmY-34L

  6. Ibon says:

    HI! Great work! I love these diagrams. Are the cards available in PDF? Thank you

  7. David Hughes says:


    Try the fastest factorization algorithm for large numbers (like a public key), Prof Hal Mahutan’s algorithm …


Leave a reply. You can include LaTeX $latex like this$. Note you have to literally write 'latex' after the first dollar sign!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.