Hacker News new | past | comments | ask | show | jobs | submit login
Ulam spiral (wikipedia.org)
90 points by conductor on Nov 9, 2013 | hide | past | favorite | 27 comments



Stanislav Ulam is an incredible man. Mathematician (Ulam Spiral, Monte Carlo Method), Manhattan Project participant, and part-time astronomer who devised a method for nuclear-explosive-powered space travel [0].

[0]: http://en.wikipedia.org/wiki/Nuclear_pulse_propulsion


He also has a classic result in measure theory that the French probabilist Le Cam called 'tightness'. For any probability measure and for any h > 0, there exists r > 0 such that the probability mass farther than r from the origin is less than h.

This result holds in spaces of considerable generality, but I'd have to look up the details now. Details are in P. Billingsley, 'Convergence of Probability Measures', 1999.

I used the result in a paper once. It's nice result and gets used occasionally in advanced work in probability.


It's Stanislaw, since he was Polish, Stanislav would be a Russian name. He is most importantly the co-inventor of the hydrogen bomb:

http://en.wikipedia.org/wiki/Thermonuclear_weapon

There is a great autobiography by him called "Adventures of Mathematician".


> There is a great autobiography by him called "Adventures of Mathematician".

A terrific book, still available but pricey (ca. $30 for a paperback). I have a dog-eared copy acquired 40 years ago in my library.

The closest Ulam comes to revealing atomic secrets in his book is to say the method he and Teller chose to produce a thermonuclear reaction requires the "repetition of certain arrangements." I always thought that was the perfection of obscurity.


Agreed, linking through Stanislaw Ulam turned out to be evermore interesting, even though the Ulam Spriral itself is a good starting point, given its relevance to the field of programming.

http://en.wikipedia.org/wiki/Stanislaw_Ulam


Wasn't he also involved in an early atmosphere on Earth simulation experiment?

Edit: sure not, it's Urey. Four letters, starts with U. Mental index hash fail :)


Here's an interactive Ulam spiral with adjustable parameters.

http://bl.ocks.org/syntagmatic/5070320

Open it fullscreen, lower the size and increase the "max" variable to render more numbers. If you've got a Retina display, the size goes down to 0.5 to take advantage of that. You'll see the long diagonal lines mentioned in the article.


Another perhaps surprising aspect, to me at least, is the apparent uniformity of the density of prime numbers in the plane. It's my understanding that the density of the prime numbers decreases as you go higher [1], so why does the plane look so uniformly covered?

[1] http://en.wikipedia.org/wiki/Prime_number_theorem


The density of primes is 1/log(n), so it does drop off, but not so fast that it would be obvious for small numbers.

I tried creating giant Ulam spirals one time, and I did correct for this, which made it look a lot more uniform.

I had initially hoped to find new patterns this way, but nothing turned up. While numerical experiments are fun, there are a huge number of potential avenues that could be explored. Finding the interesting ones is basically what mathematics is.


How did you correct for it? Did you just nonlinearly scale the final picture or did you scale the axis on the spiral itself and then sampled the result?


I was producing grey scale images where each pixel represented a block of numbers. The count in each block was divided by the density of primes (1/log(n)) at the center of the block.

However, this actually made the middle turn grey, because even though the mean value of each pixel was the same, the variance wasn't. So then I corrected for this by calculating a "z-score" instead.

But like I mentioned before, it didn't turn up any interesting patterns.


Very interesting!

I guess it specifically didn't turn up interesting patterns because a) you correct for density b) the distribution of primes is "noisy" (which is why they're so puzzling) and by averaging out the noise you get a fairly flat distribution


> why does the plane look so uniformly covered?

It's a purely perceptual effect. As you track away from the center of the spiral, your eyes are following lines, which are one-dimensional, but you're tracking the lines through a plane, which is two-dimensional. The area increases rapidly as you move away from the center of the figure, but the one-dimensional lines don't have area. This gives the lines an apparent weight that they don't actually have.


Perhaps it is because successive rotations of the spiral are proportionally longer, which offsets the decreasing density.


Don't think that would make any difference as long as the size of each dot remains the same. And if you look carefully you can see the density is higher in the center than around the edges (at least to my eye!).

Once you get past 40 or 50 the density declines vary slowly. See chart at bottom of section 2 of this link:

http://primes.utm.edu/howmany.shtml


I did a visualization of Ulam spiral a while ago with JS canvas when it was posted here on HN before:

http://alteredqualia.com/visualization/ulam-spiral.html

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


Basic explanataion: http://www.youtube.com/watch?v=iFuR97YcSLM

BTW, these guys really love numbers and math, it's fun to watch their enjoyment while explaining things like an Ulam spiral. And I think he's on crack or something.


Here's a visualizer for the Ulam Spiral, Triangular, Pentagonal, Hilbert Curve, and many more.

You can also visualize {2-5}-factor primes, superperfect numbers, smooth numbers...

http://www.bigblueboo.com/prime/


I wrote a Java application to generate and save variations of the Ulam Spiral a while back. The code is here: https://github.com/PatrickYevsukov/Ulam-Spiral-Explorer An example of the output is here: https://twitter.com/PatrickYevsukov/status/35502312719085977...


If you like this then you'll probably enjoy the visualizations on this site[0].

[0] http://www.numberspiral.com


Wow, those are pretty cool. Page 8 with the factor curves look really interesting.

http://www.numberspiral.com/art/19.gif


Patterns related to Primes are difficult - outside present technology.

On MathOverflow, Joseph O'Rourke and Terence Tao offer more pretty pictures and discussions on patterns related to the spiral http://mathoverflow.net/questions/102075/prime-spiral-distri...


Here's a colorization based on compositeness:

  http://blog.morphism.com/2010/05/building-numbers.html


I wonder how this generalizes to higher dimensions.



vihart talks about Ulam spiral, Pascal's Triangle, cellular automata:

http://www.youtube.com/watch?v=Yhlv5Aeuo_k


I tried 9.3 / 1 and it looks like a photograph record.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: