The Math Less Traveled over here shows off a lovely way of visualizing the factoring of integers by putting them into patterns inspired by the regular polygons. Some numbers factor into wonderfully obvious patterns; some turn into muddles of dots because integers just work that way. They’re all attractive ways to look at numbers, though.

In an idle moment a while ago I wrote a program to generate "factorization diagrams". Here’s 700:

It’s easy to see (I hope), just by looking at the arrangement of dots, that there are $latex 7 \times 5 \times 5 \times 2 \times 2$ in total.

Here’s how I did it. First, a few imports: a function to do factorization of integers, and a library to draw pictures (yes, this is the library I wrote myself; I promise to write more about it soon!).

`>moduleFactorizationwhere>>importMath.NumberTheory.Primes.Factorisation(factorise)>>importDiagrams.Prelude>importDiagrams.Backend.Cairo.CmdLine>>typePicture=DiagramCairoR2`

The `primeLayout`

function takes an integer `n`

(assumed to be a prime number) and some sort of picture, and symmetrically arranges `n`

copies of the picture.

View original post 583 more words