OFFSET
1,2
COMMENTS
A number is visible from the current number if, given that it has coordinates (x,y) relative to the current number, the greatest common divisor of |x| and |y| is 1. The sequence has a(2) = 3 as that is the smallest number visible from a(1) = 1 that does not differ by 1 from a(1).
The majority of steps between terms are diagonals across the current number's nearest corner of the square spiral and thus do not approach the center of the spiral. Occasionally, however, a long diagonal step directly across the center of the spiral is taken. See the linked image.
In the first 20000 terms the longest single step is the one at n = 19534 of length sqrt(38365) units between 19743 at coordinates (-68,-70), to 19460 at coordinates (70,69). This step also yields the maximum difference between terms in the same range.
LINKS
Scott R. Shannon, Image of the path for the first 20000 terms. The colors are graduated across the spectrum to show the relative step order.
EXAMPLE
The square spiral is numbered as follows:
.
17--16--15--14--13 .
| | .
18 5---4---3 12 29
| | | | |
19 6 1---2 11 28
| | | |
20 7---8---9--10 27
| |
21--22--23--24--25--26
.
a(3) = 8 as gcd(8,3) = 1 and 8 is unvisited, visible from 3, and does not equal 2 or 4.
a(4) = 5 as gcd(5,8) = 1 and 5 is unvisited, visible from 8, and does not equal 7 or 9.
a(5) = 2 as gcd(2,5) = 1 and 2 is unvisited, visible from 5, and does not equal 4 or 6.
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Sep 25 2021
STATUS
approved