Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ulam Spiral (wikipedia.org)
64 points by tosh on Aug 6, 2021 | hide | past | favorite | 19 comments


Some past threads:

The Ulam Spiral of Primes (2010) - https://news.ycombinator.com/item?id=17019533 - May 2018 (43 comments)

Ulam Spiral - https://news.ycombinator.com/item?id=11843990 - June 2016 (13 comments)

Ulam spiral - https://news.ycombinator.com/item?id=6703494 - Nov 2013 (27 comments)

The Ulam spiral: hidden structure among the prime numbers - https://news.ycombinator.com/item?id=2047857 - Dec 2010 (39 comments)

The Ulam Spiral of Primes - https://news.ycombinator.com/item?id=1452301 - June 2010 (36 comments)


I remember vihart doing a video on this (she has a lot of other great math videos too): https://www.youtube.com/watch?v=Yhlv5Aeuo_k


Are there large Ulam spirals? e.g. 100k x 100k, where each pixel is the density of prime numbers there. Do they show any interesting structure?


Sure, largely similar patterns just more zoomed out. There are well known ways to generate a coordinate conversion e.g. from http://www.survo.fi/demos/index.html#ex51

  x(n)=x(n-1)+sin(mod(int(sqrt(4*(n-2)+1)),4)*pi/2)
  y(n)=y(n-1)-cos(mod(int(sqrt(4*(n-2)+1)),4)*pi/2)
Which can make something like generating enormous spirals very quick with a simple GPU shader.


Here is one of the most enlightening explanations for these kinds of spirals I have seen by 3blue1brown: https://m.youtube.com/watch?v=EK32jo7i5LQ

Note that the setup is slightly different,since in that video they plot numbers along their polar coordinates. The results are very similar, since both create spirals with predictable angular offsets.


I also think "The distribution of the small Gaussian primes in the complex plane" image is neat.

https://upload.wikimedia.org/wikipedia/commons/c/c8/Gauss-pr...

( linked from: https://en.wikipedia.org/wiki/Gaussian_integer#Unsolved_prob... )

If you load that into MS Paint and use the fill tool with black color, all that remains are a few white dots. Diagonally, counting from zero at the center, there is a line with white pixels at 2, 5, 25, 30, 35, 70... which is https://oeis.org/A109306


I once found myself implementing Ulam's spiral in J, and was so taken by the (one) line of code it required, that I made a video about it: https://www.youtube.com/watch?v=dBC5vnwf6Zw


The article talks about cases where a quadratic "polynomial factorizes and therefore produces composite numbers as x takes the values 0, 1, 2, ..." but I'm curious about other cases when a polynomial produces only composite numbers.

In particular, can we find or test single-variable polynomials that produce an infinite number of different values, which don't all share a common factor, but which are all composite numbers (except possibly some primes near the start)?


> single-variable polynomials that produce an infinite number of different values, which don't all share a common factor, but which are all composite numbers

How about x^2 ?


That's a great simple example, thank you.


No common factors at all between any of the values, or no factor common to all the values?

The second is pretty straightforward, e.g. (x+1)*(x+3) produces 3, 8, 15, 24, 35, 48, 63, 80, 99, 120, 143, 168, 195, 224, 255, 288, 323, 360, 399, etc. for x = 0, 1, 2, ....


Good point, thank you! For some reason it didn't occur to me that such a polynomial would generate values like 143 = 11 * 13.


Are these kinds of visualization copyright, or are you free to incorporate them in artworks etc?


Most of the time as long as Disney, Warner, 20th Century, Universal, Sony, et al. are not involved, everyone are chill about copyrights.


Maybe. Until a lot of money is involved. Let's say I use a number spiral in my logo, and become the next facebook, google, etc? Would they still be chill?

I guess my question is whether there actually is a copyright here, or is it just maths?


No you have to pay me 5c in royalties each time you render it.


Does the regularity the Ulam Spiral implies make RSA easier to brute force crack?


That's pretty cool, I'd never heard of it.

I wonder what super secret representation of primes results in unknown patterns?


3blue1brown had a good video on it on YouTube




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

Search: