Hacker News new | past | comments | ask | show | jobs | submit login

Here is a quick experiment to show that the Ulam spiral indeed appears to have more prominent diagonal lines than a spiral of randomly chosen odd numbers even when the dimensions and the number of points in both spirals are same: https://github.com/mycask/ulam-vs-random

I have plotted a 99x99 grid in this experiment. One can plot larger grids to see that the difference between the two grids (the Ulam spiral and the random spiral) becomes more apparent with larger sizes.

Update: After I made these text-plots, I found that Wikipedia has much better graphical plots that demonstrates the difference:

- Ulam spiral: https://en.wikipedia.org/wiki/File:Ulam_1.png

- Random spiral: https://en.wikipedia.org/wiki/File:Randomly_black_odd_number...




> 200x200 spiral number grid with odd numbers that have a 23.38% chance of being coloured in black.

This doesn't seem to take into account that big prime numbers are less "likely" than small ones.


The square root plays a role in the distribution of primes as well as in the area of a circle. The former is involved in an upper bound for the numbers to be checked performing Sieve of Eratosthenes.


IIRC the pattern still arises even if you generate pseudo-primes randomly.


Yes, if you take into account all factors that might cause diagonal streaks more likely on real spiral as opposed to random grid, you might actually find out the real cause of this strange fact.


Here's another page who does this.

http://ulamspiral.com/generatePage.asp?ID=1




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

Search: