A330979 The squares visited on the Ulam Spiral when starting at square 1 and then stepping to the closest unvisited square which contains a prime number. If two or more squares are the same distance from the current square then the one with the smallest prime number is chosen.
1, 2, 3, 11, 29, 13, 31, 59, 61, 97, 139, 191, 251, 193, 101, 103, 67, 37, 17, 5, 19, 7, 23, 47, 79, 163, 281, 353, 283, 433, 521, 617, 523, 619, 439, 359, 223, 167, 83, 173, 229, 293, 227, 367, 449, 541, 743, 857, 977, 853
Offset: 1
Examples
a(4) = 11 as a(3) = 3, and in the Ulam Spiral 3 has adjacent surrounding neighbors 1,2,4,11,12,13,14,15. 2 is only 1 unit away but has already been visited. The other closest primes are 11 and 13, both of which are sqrt(2) units away, but 11 is chosen as 11 is less than 13.
Links
- Scott R. Shannon, Table of n, a(n) for n = 1..20000
- Scott R. Shannon, Image for the steps from n = 1 to 20000. The starting square a(1) = 1 is shown as a green dot and the square a(20000) = 1449733 is shown as a red dot. The smallest unvisited prime 727 is shown as a yellow dot. The longest step of sqrt(674) from a(7877) is shown as an orange line, and the largest difference between terms of 85126 from a(18627) is shown as a pink line.
- Scott R. Shannon, Image for the steps from n = 1 to 20000 with color. The color of each step is graduated across the spectrum from red to violet to show the relative visit order of the squares.
- Scott R. Shannon, Image for the steps from n = 1 to 10 million with color. The lowest unvisited prime 2701871 is show as a yellow dot on the left edge of an unvisited patch of squares directly above the starting square, which is shown as a larger white square. This is a large image which may take some seconds to load.
- Wikipedia, Ulam Spiral.
Extensions
a(121) and beyond, and associated images, correct by Scott R. Shannon, Feb 02 2020
Comments