A332767 The squares visited on the 2D square (Ulam) spiral when starting at square 1 and then stepping to the closest unvisited square which contains a composite number. If two or more squares are the same distance from the current square then the one with the smallest composite number is chosen.
1, 4, 15, 14, 33, 32, 30, 55, 54, 87, 86, 85, 52, 27, 10, 9, 8, 6, 18, 39, 38, 36, 35, 16, 34, 60, 95, 94, 93, 58, 57, 56, 88, 129, 128, 177, 176, 175, 126, 125, 84, 51, 26, 25, 24, 46, 45, 22, 21, 20, 40, 69
Offset: 1
Examples
a(2) = 4 as the starting square numbered 1 has three adjacent squares 1 unit away with numbers 4,6,8, and 4 is the smallest number of those. a(4) = 14 as the previous visited square 15 has three unvisited adjacent composite number 14,16,34, and 14 is the smallest number of those. a(7) = 30 as the previous number 32 is has three primes and one visited composite square one unit away. The next closest unvisited composites, sqrt(2) units away, are 30,58,60, and 30 is the smallest of those.
Links
- Scott R. Shannon, Illustration of a section of the walk up to n = 450. This shows how the square with number 12, which has four adjacent primes 1 unit away, is not visited during the initial part of the walk. Various other unvisited composites can also be seen.
- Scott R. Shannon, Illustration of the walk up to n = 1000000. The color of each step is graduated across the spectrum from red to violet to show the relative visit order of the squares. The starting square is shown as a white dot and the smallest unvisited composite square with number 12 is shown as a yellow dot. Note the walk steps shown in yellow which make a detour toward the central squares after about 150,000 steps. Click on the image to zoom in.
- Wikipedia, Ulam Spiral.
Comments