Thursday, May 27, 2010

Building Numbers

Caution: Distraction ahead.

Summary: Visualizations of Ulam Spirals.

Recently a brief discussion evolved into an hour of visualizations of the compositeness of numbers. A number that is the power of a prime seems to be closer to a prime than a number that has lots of prime factors. ω(n) is the number of distinct prime factors of n, a notion which is used here and there.

How to visualize the compositeness of a number? We tried a few approaches, some of which we'll show in future posts. For now, here are some views of the integers from 3 to 10,000, with 3 in the middle and the rest winding around it. All of these images were created with Mathematica.

Each cell is colored based on its omega. The greener, the more composite (so to speak).

A variation, this time showing the structure of each number:

Each number is represented by a square that depicts the number's prime factorization.

Color is given by the size (so to speak) of the largest prime in the factorization. We did experiment with some 3D representations.

But we didn't like those as much.

Here are some closer views of the 2D representations. Click an image to get a larger version.

If there's any interest, we can make our PDF versions available. We did one version up to 40,000:

A wall-sized print would be interesting.


  1. Thank you, these are remarkable -- I'd love to see the PDF versions!

  2. This is awesome, PDF would be nice.

  3. Posting some PDF's to this blog in a few minutes.

  4. These are amazing! Did you ever post the pdf's. I've love a poster of the last one.

  5. I'd like to see a Sack's Spiral version...

  6. Amazing, thank you for the effort...much appreciated!

  7. Here is a fun idea. Do the classic Ulam Spiral, BUT do 4 different ones based upon the end digit (1, 3, 7, 9) of the prime number. Then, if you want to play around a bit, then mix & match those sets (4! = 1*2*3*4 = 24 set permutations) to find interesting combos.