

A335364


The squares visited on the Ulam spiral when starting at square 1 and then stepping to the closest visible unvisited square which contains a prime number. If two or more visible squares are the same distance from the current square then the one with the smallest prime number is chosen.


4



1, 2, 3, 11, 29, 13, 31, 59, 89, 131, 179, 127, 83, 53, 5, 17, 37, 67, 103, 149, 101, 61, 97, 139, 191, 251, 193, 137, 313, 389, 311, 241, 307, 379, 461, 383, 467, 557, 463, 761, 653, 757, 647, 751, 863, 983, 643, 547, 457, 239, 181, 233, 173, 229, 293, 227, 223, 167, 521, 433, 353, 281
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

This sequence uses the same rules as A330979 except that, instead of stepping to the closest prime, the path steps to the closest visible square containing a prime i.e., squares containing a prime which have no other square on a line directly between the current position and the square. See A331400 for further details of the visibility of a square on the Ulam spiral.
The restriction of only visiting visible squares containing a prime substantially reduces the possible squares that the walk can step to. Consider the concentric square rings of squares surrounding any square in the Ulam spiral that contains an odd number, as all primes, other than, 2 will be. There are four squares on the adjacent ring of eight squares that are candidates for a visible prime. However on the second square ring of sixteen squares none are candidates as the only visible squares contain even numbers. This should be compared to A330979 where eight of these squares are candidates for the next step. On the third square ring of twentyfour squares only eight squares are candidates, while on the forth square ring once again there are no candidates as only even numbers are visible. This reduction in nearby candidate squares is reflected by the average step distance for a walk of 10000 steps; in this sequence the average distance is 4.60 units while in A330979 it is 2.98 units.
The first time this sequence differs from A330979 is on the ninth step. A330979(9) = 61 while a(9) = 89. The square with prime 61 is two squares directly to left left of the square a(8) = 59 and is thus blocked from view by the square containing 60, which is one square to the left. The square with prime 89 is at relative coordinates (3,1) to 59, being the closest visible unvisited prime, and is on the third square ring around 59.
In the first 10 million terms the longest required step is from a(4515899) = 29616101, which has coordinates (2721,1985) relative to the starting 1square, to a(4515900) = 28005727 with coordinates (2646,2184), a step of length sqrt(45226), approximately 212.7 units. If the maximum step distance between adjacent prime terms has a finite value or is unbounded as n increases is unknown. The largest difference between adjacent prime terms is for a(9477992) = 132533039 to a(9477993) = 125850199, a difference of 6682840.
In the first 10 million terms the smallest unvisited prime is 571, which has coordinates (6,12) relative to the starting 1square. It is unknown if this and similar unvisited prime squares near the origin are eventually visited for very large values of n or are never visited.
The keyword "look" refers to the images in the links.  N. J. A. Sloane, Jun 14 2020


LINKS

Scott R. Shannon, Table of n, a(n) for n = 1..20001
Scott R. Shannon, Image for the steps from n = 1 to 20001 with color. The starting square a(1) = 1 is shown as a white dot and the square a(20001) = 220019 is shown as a red dot. The smallest unvisited prime after 20000 steps, 107, is shown as a yellow dot. 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 5000000 with color. Note that some violet colored steps, corresponding to n values over 4000000, approach the origin, indicating earlier unvisited prime squares near the origin may eventually be visited after a large number of steps.


CROSSREFS

Cf. A000040, A063826, A115258, A136626, A330979, A331027, A331400.
Sequence in context: A335816 A330979 A336402 * A235474 A075641 A176316
Adjacent sequences: A335361 A335362 A335363 * A335365 A335366 A335367


KEYWORD

nonn,walk,look


AUTHOR

Scott R. Shannon, Jun 10 2020


STATUS

approved



