cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 17 results. Next

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.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Jan 05 2020

Keywords

Comments

The first term at which a step to a non-adjacent square is required is a(9) = 61; the previous square 59 has adjacent squares 31,32,33,58,60,93,94,95 of which only 31 is prime, but 31 has already been visited at a(7).
In the first 10 million terms the longest required step is from a(8165267) = 22147771, which has coordinates (-2353,1019) relative to the starting 1-square, to a(8165268) = 8236981 with coordinates (-1435,1355), a step of length sqrt(955620), approximately 977.6 units. See A331027 for the progression of step length records. 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(8176270) = 32960287 to a(8176271) = 18983957, a difference of 13976330.
In the first 10 million terms the smallest unvisited prime is 2701871, which has coordinates (44,822) relative to the starting 1-square. The smallest unvisited term is found to slowly increase as the number of steps increases, indicating that eventually all primes will be visited, although this is unknown. It may require an extremely large number of steps before all primes below a certain value are visited due to the decreasing likelihood of the walk taking the long steps required to visit those primes near the origin which were unvisited in earlier steps.

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.
		

Crossrefs

Extensions

a(121) and beyond, and associated images, correct by Scott R. Shannon, Feb 02 2020

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.

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, Feb 23 2020

Keywords

Comments

This sequence is the complement to A330979; here only composite numbers can be stepped to, while in A330979 only prime numbers can be stepped to. Due to the existence of many more composite numbers than primes the walk here forms a much tigher spiral and generally stays as close as possible to the origin. However the primes occasionally block this preferred path and causes the walk to detour away from the origin, which leaves gaps in the visited squares with composite numbers. Some of these gaps are eventually visited by later steps in the walk.
The first term at which a step to a non-adjacent square is required is a(154) = 74, which steps to a(155) = 158, a distance of sqrt(8) units away. The square with number 74 is surrounded by three primes 43,73,113 and five composites 44,72,75,112,114, all of which have been previously visited.
In the first 1 million terms the longest required step is from a(149464) = 64666, which has coordinates (-127,-22) relative to the starting 1-square, to a(149465) = 67774 with coordinates (-130,-43), a step of length sqrt(450), approximately 21.2 units. See A330782 for the progression of step length records. If the maximum step distance between adjacent composite terms has a finite value or is unbounded as n increases is unknown. The largest difference between adjacent composite terms is for a(650382) = 863400 to a(650383) = 939342, a difference of 75942.
In the first 1 million terms the smallest unvisited composite is 12, which is at coordinates (2,1) relative to the starting square. This square is surrounded by four primes so the walk is never required to step to it during the initial walk steps. See the image in the links. Given the composites become more frequent relative to the primes as n increases it would require a very large detour from the spiral pattern for this square to be visited, so it is likely, although unknown, this square will never be visited. However the link image for 1 million steps shows the path can make detours toward the central square when it is trapped by surrounding paths, so the possibility remains the inner unvisited squares could eventually be visited, although the number of walk steps required before such a detour occurs could be extremely large.

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.
		

Crossrefs

Cf. A330782, A000040, A063826, A136626, A331027, A330979 (same rules but stepping to prime numbers).

A331027 The records for distance squared for step lengths between adjacent primes in A330979, the visited primes for a walk stepping to the closest unvisited prime on the Ulam Spiral.

Original entry on oeis.org

1, 2, 4, 8, 10, 32, 74, 90, 136, 290, 360, 388, 394, 674, 802, 872, 1184, 1394, 3316, 4100, 5300, 5634, 10728, 23098, 25128, 26836, 33508, 53954, 61092, 66610, 92858, 187540, 190120, 215104, 217732, 955620
Offset: 1

Views

Author

Scott R. Shannon, Jan 07 2020

Keywords

Comments

The sequence A330979 gives the visited primes for a walk on the Ulam Spiral which starts at 1 and then steps to the square containing the closest unvisited prime number. This sequences lists the records for the square of the step distance between primes for that walk. For a walk of 10 million steps the largest square distance is 955620, approximately 977.6 units, which occurs between A330979(8165267) = 22147771, which has coordinates (-2353,1019) relative to the starting 1-square, to A330979(8165268) = 8236981 with coordinates (-1435,1355). See A330979 for an image of the walk. It is unknown if this is a finite or infinite sequence.

Examples

			The below table shows the details of the record step lengths of this sequence. The coordinate is relative to the starting 1-square.
--------------------------------------------------------------------------------
    a(n)  | A330979 step # |   Start prime & coord   |  End prime & coord      |
--------------------------------------------------------------------------------
       1  |         1      |         1 (0,0)         |         2 (1,0)         |
       2  |         3      |         3 (1,1)         |        11 (2,0)         |
       4  |         8      |        59 (2,4)         |        61 (0,4)         |
       8  |        14      |       193 (-3,7)        |       101 (-5,5)        |
      10  |        38      |       167 (4,-6)        |        83 (5,-3)        |
      32  |        59      |       631 (13,7)        |      1103 (17,3)        |
      74  |       169      |       113 (-3,-5)       |        53 (4,0)         |
      90  |       319      |     17239 (66,12)       |     22291 (75,15)       |
     136  |      1152      |      2719 (-26,12)      |      4127 (-32,2)       |
     290  |      1659      |     13187 (19,-57)      |      7907 (30,-44)      |
     360  |      2607      |     45263 (0,-106)      |     40283 (-18,-100)    |
     388  |      7397      |     29723 (-86,-52)     |     35509 (-94,-70)     |
     394  |      7806      |     47653 (-109,-19)    |     59663 (-122,-4)     |
     674  |      7877      |     83101 (-144,-12)    |    114419 (-169,-5)     |
     802  |     24920      |   2637497 (-812,692)    |   2515477 (-793,713)    |
     872  |     27038      |   1285799 (-409,567)    |   1170607 (-423,541)    |
    1184  |     55427      |    720089 (-288,-424)   |    653761 (-316,-404)   |
    1394  |     56478      |    460349 (-339,-325)   |    457687 (-304,-338)   |
    3316  |     56480      |    452293 (-300,-336)   |    410203 (-320,-282)   |
    4100  |     82533      |    156353 (198,130)     |    129263 (158,180)     |
    5300  |     83192      |    394211 (-140,314)    |    331697 (-208,288)    |
    5634  |    165879      |     63589 (-126,42)     |    161761 (-201,45)     |
   10728  |    237806      |   1034387 (509,-411)    |    962543 (491,-309)    |
   23098  |    556765      |    110603 (-120,-166)   |     19249 (-3,-69)      |
   25128  |    770967      |   7070333 (1330,-1278)  |   8614337 (1468,-1356)  |
   26836  |   1074758      |   3213377 (-576,-896)   |   3582083 (-420,-946)   |
   33508  |   1074809      |   4140079 (-129,-1017)  |   2995469 (-27,-865)    |
   53954  |   2257389      |  67480409 (-1709,-4107) |  72669481 (-1882,-4262) |
   61092  |   2644510      |   5269679 (790,1148)    |   5492621 (544,1172)    |
   66610  |   2644988      |   1156873 (366,538)     |    694591 (417,285)     |
   92858  |   2669627      |    109789 (166,62)      |    122443 (-117,175)    |
  187540  |   2730402      |   2509621 (-792,228)    |    672787 (-410,24)     |
  190120  |   2730411      |    193771 (-220,50)     |    296827 (74,-272)     |
  215104  |   2730444      |   1505201 (285,-613)    |   4506473 (405,-1061)   |
  217732  |   8160823      |  61908241 (-3934,1118)  |  48110423 (-3468,1142)  |
  955620  |   8165267      |  22147771 (-2353,1019)  |   8236981 (-1435,1355)  |
		

Crossrefs

Extensions

a(17)-a(20) from Scott R. Shannon, Jan 10 2020
a(7) and beyond corrected by Scott R. Shannon, Feb 02 2020

A326410 Minesweeper sequence of positive integers arranged on a square spiral on a 2D grid.

Original entry on oeis.org

4, -1, -1, 3, -1, 3, -1, 3, 3, 2, -1, 5, -1, 2, 2, 2, -1, 3, -1, 3, 3, 2, -1, 2, 1, 0, 2, 3, -1, 3, -1, 3, 3, 1, 2, 2, -1, 3, 3, 2, -1, 3, -1, 1, 1, 2, -1, 2, 1, 1, 1, 1, -1, 2, 3, 2, 2, 2, -1, 2, -1, 2, 2, 1, 3, 3, -1, 1, 2, 3, -1, 4, -1, 3, 2, 0, 1, 2, -1, 1, 1
Offset: 1

Views

Author

Witold Tatkiewicz, Oct 07 2019

Keywords

Comments

Place positive integers on a 2D grid starting with 1 in the center and continue along a spiral.
Replace each prime with -1 and each nonprime with the number of primes in adjacent grid cells around it.
n is replaced by a(n).
This sequence treats prime numbers as "mines" and fills gaps according to the rules of the classic Minesweeper game.
a(n) = 5 for n = 12.
Set of n such that a(n) = 4 is unbounded (conjecture).

Examples

			Consider positive integers distributed onto the plane along the square spiral:
.
  37--36--35--34--33--32--31
   |                       |
  38  17--16--15--14--13  30
   |   |               |   |
  39  18   5---4---3  12  29
   |   |   |       |   |   |
  40  19   6   1---2  11  28
   |   |   |           |   |
  41  20   7---8---9--10  27
   |   |                   |
  42  21--22--23--24--25--26
   |
  43--44--45--46--47--48--49--...
.
1 is not prime and in adjacent grid cells there are 4 primes: 2, 3, 5 and 7. Therefore a(1) = 4.
2 is prime, therefore a(2) = -1.
8 is not prime and in adjacent grid cells there are 4 primes: 2, 7 and 23. Therefore a(8) = 3.
Replacing n with a(n) in the plane described above, and using "." for a(n) = 0 and "*" for negative a(n), we produce a graph resembling Minesweeper, where the mines are situated at prime n:
  *---2---2---1---3---3---*
  |                       |
  3   *---2---2---2---*   3
  |   |               |   |
  3   3   *---3---*   5   *
  |   |   |       |   |   |
  2   *   3   4---*   *   3
  |   |   |           |   |
  *   3   *---3---3---2   2
  |   |                   |
  3   3---2---*---2---1---.
  |
  *---1---1---2---*---2---1---...
In order to produce the sequence, the graph is read along the square spiral.
		

Crossrefs

Cf. A136626 - similar sequence: For every number n in Ulam's spiral the sequence gives the number of primes around it (number n excluded).
Cf. A136627 - similar sequence: For every number n in Ulam's spiral the sequence gives the number of primes around it (number n included).
Different arrangements of integers:
Cf. A326405 (antidiagonals), A326406 (triangle maze), A326407 (square mapping), A326408 (square maze), A326409 (Hamiltonian path).

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Scott R. Shannon, Jun 10 2020

Keywords

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 twenty-four squares only eight squares are candidates, while on the fourth 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 1-square, 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 1-square. 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

Crossrefs

A336413 Squares visited by a chess rook moving on a square-spiral numbered board where the rook moves to the closest unvisited square containing a prime number. In case of a tie it chooses the square with the smallest prime number.

Original entry on oeis.org

1, 2, 3, 5, 7, 41, 43, 109, 107, 103, 37, 193, 191, 97, 101, 199, 197, 683, 677, 673, 1753, 1747, 1429, 1427, 887, 883, 661, 659, 881, 877, 307, 461, 463, 653, 1129, 1733, 2083, 2081, 3323, 3319, 3797, 3793, 5419, 5417, 5413, 4297, 2861, 2857, 2447, 2069, 1723, 1721, 1409, 1123, 1117, 1399
Offset: 1

Views

Author

Scott R. Shannon, Jul 21 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a chess rook moving on a square-spiral numbered board where the rook starts on the 1 numbered square and at each step moves to the closest unvisited square containing a prime number. The movement is restricted to the four directions a rook can move on a standard chess board, and the rook cannot move over a previously visited square. If two or more unvisited prime numbered squares exist which are the same distance from the current square then the one with the smallest prime number is chosen. Note that if the rook simply moves to the closest unvisited square the sequence will be infinite as the rook will just follow the square spiral path.
The sequence is finite. After 350 steps the square with number 2179 is visited, after which all four squares the rook can move to have been visited.
The first term where this sequence differs from A336447, where the rook steps to the smallest unvisited prime, is a(7) = 43. See the examples below.
The largest visited square is a(151) = 30539. Both the largest step distance between visited squares, 24 units, and the largest prime gap between visited squares, 6744, occur between a(229) = 2143 and a(230) = 8887. The smallest unvisited prime is 11.

Examples

			The board is numbered with the square spiral:
.
  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(1) = 1, the starting square for the rook.
a(2) = 2. The four unvisited prime numbered squares around a(1) the rook can move to are numbered 2,61,19,23. Of these 2 is the closest, being 1 unit away.
a(3) = 3. The three unvisited prime numbered squares around a(2) = 2 the rook can move to are numbered 47,11,3. Both 11 and 3 are 1 units away, and of those 3 is the smallest.
a(7) = 43. The three unvisited prime numbered squares around a(6) = 41 the rook can move to are numbered 37,43,107. Both 43 and 107 are 2 units away, and of those 43 is the smallest. Note that 37, the smallest available prime, is 4 units away.
a(230) = 8887. There is only one unvisited prime numbered square around a(229) = 2143 the rook can move to. The square 8887 is 24 units away to the left of 2143.
		

Crossrefs

A336447 Squares visited by a chess rook moving on a square-spiral numbered board where the rook moves to an unvisited square containing the smallest prime number.

Original entry on oeis.org

1, 2, 3, 5, 7, 41, 37, 31, 29, 521, 509, 337, 109, 43, 47, 83, 89, 179, 173, 359, 353, 349, 113, 293, 307, 311, 313, 317, 191, 97, 101, 103, 107, 691, 683, 197, 193, 1429, 1427, 887, 883, 661, 659, 653, 463, 461, 457, 181, 467, 479, 1163, 1171, 331, 673, 677, 1153, 1151, 487, 491, 199
Offset: 1

Views

Author

Scott R. Shannon, Jul 22 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a chess rook moving on a square-spiral numbered board where the rook starts on the 1 numbered square and at each step moves to an unvisited square containing the smallest prime number. The movement is restricted to the four directions a rook can move on a standard chess board, and the rook cannot move over a previously visited square. Note that if the rook simply moves to an unvisited square containing the smallest number the sequence will be infinite as the rook will just follow the square spiral path.
The sequence is finite. After 134 steps the square with number 863 is visited, after which all four squares the rook can move to have been visited.
The first term where this sequence differs from A336413, where the rook steps to the closest unvisited prime, is a(7) = 37. See the examples below.
The largest visited square is a(102) = 3739. The largest step distance between visited squares is 24 units, between a(128) = 2179 to a(129) = 2203. The largest prime gap between visited squares is 2646, from a(101) = 1093 to a(102) = 3739. The smallest unvisited prime is 11.

Examples

			The board is numbered with the square spiral:
.
  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(1) = 1, the starting square for the rook.
a(2) = 2. The four unvisited prime numbered squares around a(1) the rook can move to are numbered 2,61,19,23. Of these 2 is the smallest.
a(7) = 37. The three unvisited prime numbered squares around a(6) = 41 the rook can move to are numbered 37,43,107. Of those 37 is the smallest. Note that 43 is the closest prime, being only 2 units away while 37 is 4 units away.
a(135) = 863. The final square. The three previously visited prime numbered squares around a(135) are numbered 191,859,1709. Note there is no fourth prime as the column of squares directly upward from 863 contains no primes; the values from 871,994,1125,... and beyond fit the quadratic 4n^2+119n+871, which can be factored as (4n+67)*(n+13), and thus contains no primes.
		

Crossrefs

A336402 Squares visited by a chess queen moving on a square-spiral numbered board where the queen moves to the closest unvisited square containing a prime number. In case of a tie it chooses the square with the smallest prime number.

Original entry on oeis.org

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, 227, 293, 229, 173, 83, 233, 127, 53, 179, 131, 89, 137, 389, 313, 311, 467, 383, 307, 241, 239, 181, 457, 547, 643
Offset: 1

Views

Author

Scott R. Shannon, Jul 20 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a chess queen moving on a square-spiral numbered board where the queen starts on the 1 numbered square and at each step moves to the closest unvisited square containing a prime number. The movement is restricted to the eight directions a queen can move on a standard chess board, and the queen cannot move over a previously visited square If two or more unvisited prime numbered squares exist which are the same distance from the current square then the one with the smallest prime number is chosen. Note that if the queen simply moves to the closest unvisited square the sequence will be infinite as the queen will just follow the square spiral path.
The sequence is finite. After 519 steps the square with number 1289 is visited, after which all eight squares the queen can move to have been visited.
The first term where this sequence differs from A330979, which steps to the closest unvisited prime without any movement direction restrictions, is a(40) = 227. See the examples below.
The largest visited square is a(292) = 14843. The largest step distance between visited squares is 20 units, between a(338) = 2879 to a(339) = 3779. The largest prime gap between visited squares is 4050, from a(396) = 10667 to a(397) = 14717. The smallest unvisited prime is 41.

Examples

			The board is numbered with the square spiral:
.
  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(1) = 1, the starting square for the queen.
a(2) = 2. The seven unvisited prime numbered squares around a(1) the queen can move to are numbered 2,3,61,5,19,7,23. Of these 2 is the closest, being 1 unit away. There are no primes in the south-east direction from a(1).
a(4) = 11. The four unvisited prime numbered squares around a(3) = 3 the queen can move to are numbered 11,29,13,5, the other two directions not having any primes. Both 11 and 13 are sqrt(2) units away, and of those 11 is the smallest.
a(40) = 227. The three unvisited prime numbered squares around a(39) = 167 the queen can move to are numbered 227,173,53, Of these 227 is the closest, being 4 units away. Note that the square with prime number 83 is only sqrt(10), about 3.16, units away but is at relative coordinates (1,3) to 167 so cannot be reach by the queen.
		

Crossrefs

A336446 Squares visited by a chess queen moving on a square-spiral numbered board where the queen moves to an unvisited square containing the smallest prime number.

Original entry on oeis.org

1, 2, 3, 5, 7, 19, 17, 13, 11, 23, 47, 43, 41, 37, 31, 29, 53, 127, 79, 73, 71, 67, 103, 101, 97, 61, 59, 131, 89, 83, 173, 167, 163, 157, 151, 107, 109, 271, 211, 199, 197, 193, 191, 139, 137, 239, 181, 179, 641, 457, 241, 251, 257, 263, 149, 397, 389, 313, 311, 307, 293, 113, 281
Offset: 1

Views

Author

Scott R. Shannon, Jul 22 2020

Keywords

Comments

This sequences gives the numbers of the squares visited by a chess queen moving on a square-spiral numbered board where the queen starts on the 1 numbered square and at each step moves to an unvisited square containing the smallest prime number. The movement is restricted to the eight directions a queen can move on a standard chess board, and the queen cannot move over a previously visited square. Note that if the queen simply moves to an unvisited square containing the smallest number the sequence will be infinite as the queen will just follow the square spiral path.
The sequence is finite. After 5880 steps the square with number 55903 is visited, after which all eight squares the queen can move to have been visited.
The first term where this sequence differs from A336402, where the queen steps to the closest unvisited prime, is a(4) = 5. See the examples below.
The largest visited square is a(4943) = 79187. The largest step distance between visited squares is 72 units, between a(3205) = 31397 to a(3206) = 31469. The largest prime gap between visited squares is 30150, from a(4942) = 49037 to a(4943) = 79187. The smallest unvisited prime is 45833.

Examples

			The board is numbered with the square spiral:
.
  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(1) = 1, the starting square for the queen.
a(2) = 2. The seven unvisited prime numbered squares around a(1) the queen can move to are numbered 2,3,61,5,19,7,23. Of these 2 is the smallest. There are no primes in the south-east direction from a(1).
a(4) = 5. The four unvisited prime numbered squares around a(3) = 3 the queen can move to are numbered 11,29,13,5, the other two available directions not having any primes. Of these 5 is the smallest. Note that 11 is the closest prime, being only sqrt(2) units away while 5 is 2 units away.
a(4943) = 79187. This is only unvisited square containing a prime number around a(4942) = 49037. It is 30 units away to the right.
		

Crossrefs

A336494 The number of steps for a walk on a square spiral numbered board when starting on square 1 and stepping to an unvisited square containing the lowest prime number, where the square is within a block of size (2n+1) X (2n+1) centered on the current square. If no unvisited prime numbered squares exist within the block the walk ends.

Original entry on oeis.org

7, 37, 65, 308, 654, 7214, 21992, 49850, 222791, 1146922, 1912101, 6372680, 23077800
Offset: 1

Views

Author

Scott R. Shannon, Jul 23 2020

Keywords

Comments

For n = 1 this sequence is similar to A335856 except that only prime numbers can be stepped to; if no adjacent prime number exists then the walk ends. In general for a(n) the walk can step to any unvisited square containing the lowest prime number within a block of size (2n+1) X (2n+1) centered on the current square.
See A336576 for the final square number of the walks.

Examples

			The board is numbered with the square spiral:
.
  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(1) = 7. Starting from the square 1 the sequence of adjacent unvisited lowest primes the walk can step to are 2,3,11,29,13,31,59. Once the square 59 is visited there are no other unvisited adjacent squares containing primes, so the walk terminates after 7 steps. See the first linked image.
a(2) = 38. This walk also starts by stepping to 2 and then 3. But the next lowest prime 5 is now two units away so is reachable and is thus the next stepped to square. Further steps are 7,19,17,37...,827,829,719,947. Once the square 947 is visited there are no other unvisited squares containing primes within the surrounding 5x5 block of squares, so the walk terminates after 38 steps. See the second linked image.
Also see the linked images for n=3,4,5,6.
		

Crossrefs

Cf. A336576 (final square number), A335856, A000040, A136626, A336092, A330979, A332767, A335661, A335364.
Showing 1-10 of 17 results. Next