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.

Previous Showing 11-20 of 49 results. Next

A141481 Square spiral of sums of selected preceding terms, starting at 1.

Original entry on oeis.org

1, 1, 2, 4, 5, 10, 11, 23, 25, 26, 54, 57, 59, 122, 133, 142, 147, 304, 330, 351, 362, 747, 806, 880, 931, 957, 1968, 2105, 2275, 2391, 2450, 5022, 5336, 5733, 6155, 6444, 6591, 13486, 14267, 15252, 16295, 17008, 17370, 35487, 37402, 39835, 42452, 45220
Offset: 1

Views

Author

Niclas Rantala (nrantala(AT)hotmail.com), Aug 09 2008

Keywords

Comments

Enter 1 into center position of the spiral. Repeat: Go to next position of the spiral and enter into that position the sum of the numbers in those already filled positions that are horizontally, vertically or diagonally adjacent to it.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  362--747--806--880--931
    |
  351   11---23---25---26
    |    |              |
  330   10    1----1   54
    |    |         |    |
  304    5----4----2   57
    |                   |
  147--142--133--122---59
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=1, ","); T=[[1, 0], [1, -1], [0, -1], [ -1, -1], [ -1, 0], [ -1, 1], [0, 1], [1, 1]]; for(n=1, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=0; for(c=1, 8, v=[j, k]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","))} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(9) by Klaus Brockhaus, Aug 27 2008

A113688 Isolated semiprimes in the semiprime square spiral.

Original entry on oeis.org

65, 74, 249, 295, 309, 355, 422, 511, 545, 667, 669, 758, 926, 943, 979, 998, 1099, 1167, 1186, 1322, 1457, 1469, 1561, 1585, 1658, 1711, 1774, 1779, 1835, 1891, 1959, 1961, 1963, 2021, 2038, 2066, 2155, 2186, 2191, 2206, 2271, 2329, 2342
Offset: 1

Views

Author

Jonathan Vos Post, Nov 05 2005

Keywords

Comments

Write the integers 1, 2, 3, 4, ... in a counterclockwise square spiral. Analogous to Ulam's marking the primes in the spiral and discovering unexpectedly many connected diagonals, we construct a semiprime spiral by marking the semiprimes (A001358). Each integer has 8 adjacent integers in the spiral, horizontally, vertically and diagonally. Curious extended clumps coagulate, slightly denser towards the origin, of semiprimes connected by adjacency. This sequence lists the isolated semiprimes in the semiprime spiral, namely those semiprimes none of whose adjacent integers in the spiral are semiprimes. A113689 gives an enumeration of the number of semiprimes in clumps of size > 1 through n^2.
The squares of twin primes occupy adjacent points along the southeast diagonal, so none are isolated. Thus the only isolated semiprimes in the spiral that are squares are the squares of "isolated primes" (A007510). The first square in this sequence is a(1473) = 66049 = 257^2. - Jon E. Schoenfield, Aug 12 2018

Examples

			Spiral example:
.
  17--16--15--14--13
   |               |
  18   5---4---3  12
   |   |       |   |
  19   6   1---2  11
   |   |           |
  20   7---8---9--10
   |
  21--22--23--24--25
.
From _Michael De Vlieger_, Dec 22 2015: (Start)
Spiral including n <= 121 showing only semiprimes; the isolated semiprimes appear in parentheses:
.
    .---.---.---.---.---.--95--94--93---.--91
    |                                       |
    . (65)--.---.--62---.---.---.--58--57   .
    |   |                               |   |
    .   .   .---.--35--34--33---.---.   .   .
    |   |   |                       |   |   |
    .   .  38   .---.--15--14---.   .  55   .
    |   |   |   |               |   |   |   |
    .   .  39   .   .---4---.   .   .   .  87
    |   |   |   |   |       |   |   |   |   |
  106  69   .   .   6   .---.   .   .   .  86
    |   |   |   |   |           |   |   |   |
    .   .   .   .   .---.---9--10   .   .  85
    |   |   |   |                   |   |   |
    .   .   .  21--22---.---.--25--26  51   .
    |   |   |                           |   |
    .   .   .---.---.--46---.---.--49---.   .
    |   |                                   |
    .   .-(74)--.---.--77---.---.---.---.--82
    |
  111---.---.---.-115---.---.-118-119---.-121
.
(End)
		

References

  • S. M. Ellerstein, The square spiral, J. Recreational Mathematics 29 (#3, 1998) 188; 30 (#4, 1999-2000), 246-250.

Crossrefs

Cf. A115258 (isolated primes in Ulam's lattice).

Programs

  • Mathematica
    spiral[n_] := Block[{o = 2 n - 1, t, w}, t = Table[0, {o}, {o}]; t = ReplacePart[t, {n, n} -> 1]; Do[w = Partition[Range[(2 (# - 1) - 1)^2 + 1, (2 # - 1)^2], 2 (# - 1)] &@ k; Do[t = ReplacePart[t, {(n + k) - (j + 1), n + (k - 1)} -> #[[1, j]]]; t = ReplacePart[t, {n - (k - 1), (n + k) - (j + 1)} -> #[[2, j]]]; t = ReplacePart[t, {(n - k) + (j + 1), n - (k - 1)} -> #[[3, j]]]; t = ReplacePart[t, {n + (k - 1), (n - k) + (j + 1)} -> #[[4, j]]], {j, 2 (k - 1)}] &@ w, {k, 2, n}]; t]; f[w_] := Block[{d = Dimensions@ w, t, g}, t = Reap[Do[Sow@ Take[#[[k]], {2, First@ d - 1}], {k, 2, Last@ d - 1}]][[-1, 1]] &@ w; g[n_] := If[n != 0, Total@ Join[Take[w[[Last@ # - 1]], {First@ # - 1, First@ # + 1}], {First@ #, Last@ #} &@ Take[w[[Last@ #]], {First@ # - 1, First@ # + 1}], Take[w[[Last@ # + 1]], {First@ # - 1, First@# + 1}]] &@(Reverse@ First@ Position[t, n] + {1, 1}) == 0, False]; Select[Union@ Flatten@ t, g@ # &]]; t = spiral@ 26 /. n_ /; PrimeOmega@ n != 2 -> 0; f@ t (* Michael De Vlieger, Dec 21 2015, Version 10 *)

Extensions

Corrected and extended by Alois P. Heinz, Jan 02 2011

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

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

A113689 Number of semiprimes in clumps of size > 1 through n^2 in the semiprime spiral.

Original entry on oeis.org

0, 0, 2, 6, 9, 13, 17, 21, 23, 31, 37, 45, 54, 59, 72, 77, 83, 93, 104, 116, 125, 140, 150, 164, 180, 188, 203, 219, 236, 255, 272, 287, 301, 317, 334, 354, 378, 403, 419, 430, 450, 475, 498, 521, 542, 560, 588, 608, 626, 652, 677, 698
Offset: 1

Views

Author

Jonathan Vos Post, Nov 05 2005

Keywords

Comments

Write the integers 1, 2, 3, 4, ... in a counterclockwise square spiral. Analogous to Ulam coloring in the primes in the spiral and discovering unexpectedly many connected diagonals, we construct a semiprime spiral by coloring in all semiprimes (A001358). Each integer has 8 adjacent integers in the spiral, horizontally, vertically and diagonally. Curious extended clumps coagulate, slightly denser towards the origin, of semiprimes connected by adjacency. This sequence, A113689, gives an enumeration of the number of semiprimes in clumps of size > 1 through n^2, not looking past the square boundary. A113688 gives isolated semiprimes in the semiprime spiral, namely those semiprimes none of whose adjacent integers in the spiral are semiprimes.

Examples

			a(3) = 2 because there is one visible clump through 3^2 = 9, {4,6}, which two semiprimes are diagonally connected.
a(4) = 6 because there are 6 semiprimes in the 2 visible clumps through 4^2 = 16, {4, 6, 14, 15}, {9, 10}.
a(5) = 9 because there are 9 semiprimes in the 3 visible clumps through 5^2 = 25, {4, 6, 14, 15}, {9, 10, 25}, {21, 22}.
......................
... 17 16 15 14 13 ...
... 18  5  4  3 12 ...
... 19  6  1  2 11 ...
... 20  7  8  9 10 ...
... 21 22 23 24 25 ...
......................
		

References

  • S. M. Ellerstein, The square spiral, J. Recreational Mathematics 29 (#3, 1998) 188; 30 (#4, 1999-2000), 246-250.

Crossrefs

Extensions

Corrected and extended by Alois P. Heinz, Jan 02 2011

A265409 a(n) = index to the nearest inner neighbor in Ulam-style square-spirals using zero-based indexing.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 9, 9, 9, 10, 11, 12, 12, 12, 13, 14, 15, 16, 16, 16, 17, 18, 19, 20, 20, 20, 21, 22, 23, 24, 25, 25, 25, 26, 27, 28, 29, 30, 30, 30, 31, 32, 33, 34, 35, 36, 36, 36, 37, 38, 39, 40, 41, 42, 42, 42, 43, 44, 45, 46, 47, 48, 49, 49, 49, 50
Offset: 1

Views

Author

Antti Karttunen, Dec 13 2015

Keywords

Comments

Each n occurs A265411(n+1) times.
Useful when defining recurrences like A078510 and A265408.

Examples

			We arrange natural numbers as a counterclockwise spiral into the square grid in the following manner (here A stands for 10, B for 11). The first square corresponds with n (where the initial term 0 is at the center), and the second square with the value of a(n). This sequence doesn't specify a(0), thus it is shown as an asterisk (*):
                    44322
            432B    40002B
            501A    50*01A
            6789    600119
                    667899
-
For each n > 0, we look for the nearest horizontally or vertically adjacent neighbor of n towards the center that is not n-1, which will then be value of a(n) [e.g., it is 0 for 3, 5 and 7, while it is 1 for 8, 9 and A (10) and 2 for B (11)] unless n is in the corner (one of the terms of A002620), in which case the value is the nearest diagonally adjacent neighbor towards the center, e.g. 0 for 2, 4 and 6, while it is 1 for 9).
See also the illustration at A078510.
		

Crossrefs

One less than A265410(n+1).

Formula

If n <= 7, a(n) = 0 for n >= 8: if either A240025(n) or A240025(n-1) is not zero [when n or n-1 is in A002620], then a(n) = a(n-1), otherwise, a(n) = 1 + a(n-1).
If n <= 7, a(n) = 0, for n >= 8, a(n) = a(n-1) + (1-A240025(n))*(1-A240025(n-1)). [The same formula in a more compact form.]
a(n) = A265410(n+1) - 1.
Other identities. For all n >= 0:
a(n) = n - A265359(n).

A094767 Square spiral of sums of selected preceding terms, starting at 1 (a spiral Fibonacci-like sequence).

Original entry on oeis.org

1, 1, 2, 4, 8, 13, 26, 40, 81, 123, 205, 412, 620, 1034, 2072, 3120, 5204, 8332, 16677, 25056, 41772, 66854, 133748, 200749, 334741, 535694, 870558, 1741321, 2612619, 4355177, 6968828, 11324625, 22650284, 33978635, 56635145, 90624176, 147267645
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jun 10 2004

Keywords

Comments

Enter 1 into center position of the spiral. Repeat: Add to the number in the present position the numbers in all those already filled positions that are horizontally, vertically or diagonally adjacent to it, go to next position of the spiral and enter the sum into it.
a(1) = 1, a(n) = a(n-1) + Sum_{i < n-1 and a(i) is adjacent to a(n-1)} a(i).
Here eight positions are considered adjacent, only four however in A094768.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  41772---66854--133748--200749--334741
      |
      |
      |
  25056      26------40------81-----123
      |       |                       |
      |       |                       |
      |       |                       |
  16677      13       1-------1     205
      |       |               |       |
      |       |               |       |
      |       |               |       |
   8332       8-------4-------2     412
      |                               |
      |                               |
      |                               |
   5204----3120----2072----1034-----620
.
where
  a(2) = a(1) = 1,
  a(3) = a(2) + a(1) = 2,
  a(4) = a(3) + a(2) + a(1) = 4,
  a(5) = a(4) + a(3) + a(2) + a(1) = 8,
  a(6) = a(5) + a(4) + a(1) = 13,
  a(7) = a(6) + a(5) + a(4) + a(1) = 26.
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=1, ","); pj=m; pk=m; T=[[1, 0], [1, -1], [0, -1], [ -1, -1], [ -1, 0], [ -1, 1], [0, 1], [1, 1]]; for(n=1, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=A[pj, pk]; for(c=1, 8, v=[pj, pk]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","); pj=j; pk=k)} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(14) by Klaus Brockhaus, Aug 27 2008

A094769 Square spiral of sums of selected preceding terms, starting at 0 followed by 1 (a spiral Fibonacci-like sequence).

Original entry on oeis.org

0, 1, 1, 2, 4, 6, 12, 18, 37, 56, 94, 189, 285, 475, 952, 1434, 2392, 3830, 7666, 11518, 19202, 30732, 61482, 92281, 153874, 246248, 400178, 800450, 1200967, 2001985, 3203426, 5205696, 10411867, 15619275, 26034003, 41658056, 67695885, 109356333
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jun 10 2004

Keywords

Comments

Enter 0 into center position and 1 into next position of the spiral. Repeat: Add to the number in the present position the numbers in all those already filled positions that are horizontally, vertically or diagonally adjacent to it, go to next position of the spiral and enter the sum into it.
a(1) = 0, a(2) = 1, a(n) = a(n-1) + Sum_{i < n-1 and a(i) is adjacent to a(n-1)} a(i).
As in A094767 eight positions are considered adjacent here.
Clockwise and counterclockwise construction of the spiral result in the same sequence.

Examples

			Clockwise constructed spiral begins
.
  19202--30732--61482--92281-153874
      |
      |
  11518     12-----18-----37-----56
      |      |                    |
      |      |                    |
   7666      6      0------1     94
      |      |             |      |
      |      |             |      |
   3830      4------2------1    189
      |                           |
      |                           |
   2392---1434----952----475----285
.
where
  a(1) = 0,
  a(2) = 1,
  a(3) = a(2) + a(1) = 1,
  a(4) = a(3) + a(2) + a(1) = 2,
  a(5) = a(4) + a(3) + a(2) + a(1) = 4,
  a(6) = a(5) + a(4) + a(1) = 6,
  a(7) = a(6) + a(5) + a(4) + a(1) = 12.
		

Crossrefs

Programs

  • PARI
    {m=5; h=2*m-1; A=matrix(h, h); print1(A[m, m]=0, ","); print1(A[m, m+1]=1, ","); pj=m; pk=m+1; T=[[1, 0], [1, -1], [0, -1], [ -1, -1], [ -1, 0], [ -1, 1], [0, 1], [1, 1]]; for(n=2, (h-2)^2-1, g=sqrtint(n); r=(g+g%2)\2; q=4*r^2; d=n-q; if(n<=q-2*r, j=d+3*r; k=r, if(n<=q, j=r; k=-d-r, if(n<=q+2*r, j=r-d; k=-r, j=-r; k=d-3*r))); j=j+m; k=k+m; s=A[pj, pk]; for(c=1, 8, v=[pj, pk]; v+=T[c]; s=s+A[v[1], v[2]]); A[j, k]=s; print1(s, ","); pj=j; pk=k)} \\ Klaus Brockhaus, Aug 27 2008

Extensions

Edited and extended beyond a(12) by Klaus Brockhaus, Aug 27 2008

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

Previous Showing 11-20 of 49 results. Next