I’d recently ordered Ben Fry‘s Visualizing Data and started reading it this weekend; just a few pages in I learnt how to import data to processing and a project was born… Since New Orleans I’ve been increasingly interested in mathematical art, and whether in particular I could create something interactive. Here’s what I’ve come up with after a couple of rainy afternoons:
[processing width="720" height="760" file="http://maths.straylight.co.uk/processing/smooth_spiral.jar" method="onclick"]Load the applet[/processing]
So what is it? Each point represents a number up to 10,000, arranged on an Archimedean spiral, and coloured depending on its smoothness: a smooth number is one with only small prime factors. More precisely, N is B-smooth if the largest prime dividing N is at most B (so 2-smooth numbers are powers of 2; 3-smooth numbers are multiples of 2 and/or 3 only; any number shown will obviously be at worst 10,000-smooth). You can adjust the smoothness bound with the slider: in ‘gradient’ mode the brighter a point, the smoother it is; whereas in ‘threshold’ mode a point is simply plotted or not depending on whether it passes the smoothness test (the mode can be toggled by pressing space).
The least smooth numbers are the primes, and it was thinking about prime spirals that lead me in this direction: the Ulam spiral is one of the first examples of computer-aided mathematics visualisation, and I’ve taken the circular layout from its close relative, the Sacks spiral. In fact, my original plan was to use the number of prime divisors, rather than smoothness, for deciding when to plot points, with the Sacks spiral as a special case. But the pictures for larger bounds weren’t particularly interesting- 10,000 just isn’t big enough to allow much of a range of behaviour. So I switched to smoothness, and whilst that means you can’t identify the primes directly, sometimes they’re conspicuous by their absence: in the Sacks spiral there are curves with an unusually high concentration of primes, and in the smoothness spiral there are similarly ‘missing’ curves. There seem to be lots of other features too- if you’d like a closer look, here’s an enormous render of the 101-smooth numbers shown above, created using processing’s PDF mode.