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 10 results.

A323813 Squares where A323809 gets stuck.

Original entry on oeis.org

2083, 2719, 3324, 3752, 7775, 5631, 7410, 8561, 14075, 8468, 9230, 22701, 14660, 21709, 21077, 25808, 27111, 24707, 19843, 26942, 26736, 32448, 31365, 45035, 37852, 37187, 43317, 62094, 67400, 68735, 70847, 62788, 63222, 69244, 85384
Offset: 1

Views

Author

Daniël Karssen, Jan 28 2019

Keywords

Crossrefs

Cf. A323809.

A316667 Squares visited by a knight moving on a spirally numbered board always to the lowest available unvisited square.

Original entry on oeis.org

1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36
Offset: 1

Views

Author

Daniël Karssen, Jul 10 2018, following a suggestion from N. J. A. Sloane, Jul 09 2018

Keywords

Comments

Board is numbered with the square spiral:
.
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--26
.
This sequence is finite: At step 2016, square 2084 is visited, after which there are no unvisited squares within one knight move.

Crossrefs

Cf. A316328 (same starting at 0), A329022 (same with diamond-shaped spiral), A316588 (variant on board with x,y >= 0).
Cf. A326924 (choose square closest to the origin), A328908 (using taxicab distance), A328909 (using sup norm); A323808, A323809.
The (x,y) coordinates of square k are (A174344(k), A274923(k)).

Programs

Formula

a(n) = A316328(n-1) + 1.

A316328 Lexicographically earliest knight's path on spiral on infinite chessboard.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 42, 69, 20, 39, 16, 33, 12, 27, 24, 45, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 50, 47, 76, 113, 72, 107, 150, 67, 102, 63, 66, 35
Offset: 0

Views

Author

N. J. A. Sloane, Jul 13 2018

Keywords

Comments

On a doubly-infinite chessboard, number all the cells in a counterclockwise spiral starting at a central cell labeled 0. Start with a knight at cell 0, and thereafter always move the knight to the smallest unvisited cell. Sequence gives succession of squares visited.
Sequence ends if knight is unable to move.
Inspired by A316588 and, like that sequence, has only finitely many terms; see A316667 for details.
See A326924 for a variant where the knight prefers squares closest to the origin, and gets trapped only after 22325 moves. - M. F. Hasler, Oct 21 2019
See A323809 for an infinite extension of this sequence, obtained by allowing the knight to go back in case it was trapped. See A328908 for a variant of length > 10^6, using the taxicab distance, and A328909 for a variant using the sup norm. - M. F. Hasler, Nov 04 2019

Examples

			The board is spirally numbered, starting with 0 at (0,0), as follows:
.
  16--15--14--13--12   :
   |               |   :
  17   4---3---2  11  28
   |   |       |   |   |
  18   5   0---1  10  27
   |   |           |   |
  19   6---7---8---9  26
   |                   |
  20--21--22--23--24--25
.
Coordinates of a point are given in A174344, A274923 and A296030 (but these have offset 1: they list coordinates of the n-th point on the spiral, so the coordinates of first point, 0 at the origin, have index n = 1, etc).
Starting at the origin, a(0) = 0, the knight jumps to the square with the lowest number at the eight available positions, (+-2, +-1) or (+-1, +-2), which is a(1) = 9 at (2, -1).
From there, the available square with the lowest number is a(2) = 2 at (1, 1): square 0 at the origin is not available since already occupied earlier. Similarly, the knight will not be allowed to go on squares a(1) = 9 or a(2) = 2 ever after.
		

Crossrefs

Cf. A316667 (same with offset 1 and values +1), A316338 (numbers not in this sequence).
Cf. A323809 (infinite extension of this sequence).
Cf. A316588 (variant with diagonally numbered board, coordinates x, y >= 0).
Cf. A326924 and A326922 (variant: choose square closest to the origin), A328908 and A328928 (variant using taxicab distance); A328909 and A328929 (variant using sup norm).
Cf. A326916 and A326918, A326413, A328698 (squares are filled with digits of the infinite word 0,1,...9,1,0,1,1,...).
Cf. A174344, A274923, A296030 (coordinates of a given square).

Programs

  • PARI
    {local( K=[[(-1)^(i\2)<<(i>4),(-1)^i<<(i<5)]|i<-[1..8]], nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1], pos(x,y)=if(y>=abs(x),4*y^2-y-x,-x>=abs(y),4*x^2-x-y,-y>=abs(x),(4*y-3)*y+x,(4*x-3)*x+y), coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n]), U=[], t(x, p=pos(x[1],x[2]))=if(p<=U[1]||setsearch(U, p), oo, p)); my(A=List(0)); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of the last term: ", #A-1); A316328(n)=A[n+1];}

Formula

a(n) = A316667(n+1) - 1.

Extensions

Terms from a(17) on computed by Daniël Karssen, Jul 10 2018
Examples added and crossrefs edited by M. F. Hasler, Nov 04 2019

A328909 Knight's tour on spirally numbered infinite board, when the knight always jumps on the unvisited square closest to the origin, first according to the sup-norm, then 2-norm, then number of the square: a(n) = number of square visited at move n.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 42, 69, 20, 39, 16, 33, 12, 27, 24, 45, 74, 41, 68, 103, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 160, 75, 116, 47, 76, 113, 72, 107, 150, 67, 36, 61, 94, 57, 54, 85, 50, 79, 82
Offset: 0

Views

Author

M. F. Hasler, Oct 31 2019

Keywords

Comments

Differs from A326924 (where only the 2-norm is considered) from a(34) = 42 on, and from A316328 (which considers only the number of the square) from a(48) = 38 on.
When the knight lands on square number a(25108) = 21040 of coordinates (73, -57), there is no unvisited square within reach. The sequence then stops, or can be extended by specifying that the knight has to go back on its path until an unvisited square comes within reach, as in A323809.
The least unvisited square at move 25108 is square number 17822 at (67,67). It is however close to the border of the visited region and the knight will visit it in the infinite extension of the sequence shortly after, at move n = 25358. Is there a square that will never be visited in that infinite extension? (Cf. comments in A323809.) - M. F. Hasler, Nov 04 2019

Examples

			The squares are numbered as in the spiral given in A174344 (upside down to get a counterclockwise spiral, but this is irrelevant here).
The knight starts at a(0) = 0 with coordinates (0, 0).
It jumps to a(1) = 9 with coordinates (2, -1): all 8 available squares (+-2, +-1) and (+-1, +-2) are at the same sup-norm and Euclidean distance from the origin, but square number 9 has the smallest number.
		

Crossrefs

Cf. A328929 for the value on the visited square, sup norm of coordinates of a(n).
Cf. A323809 ~ A316328 ~ A316667, A326924, A328908 (variants).
Cf. A174344, A274923, A296030 (coordinates of square number n).

Programs

  • PARI
    {local(coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n]), U=[]/*used squares*/, K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves*/, pos(x,y)=if(y>=abs(x), 4*y^2-y-x, -x>=abs(y),4*x^2-x-y, -y>=abs(x),(4*y-3)*y+x, (4*x-3)*x+y), t(x, p=pos(x[1],x[2]))=if(p<=U[1]||setsearch(U, p), oo, [vecmax(abs(x)), norml2(x), p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][3]); my(A=List(0)/*list of positions*/); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of last term: ", #A-1); A328909(n)=A[n+1];} \\ To compute the infinite extension of the sequence, set en upper limit to the for() loop and replace "break" by listput(A, A[n-1])

Formula

A328929(n) = max(|A174344(a(n))|, |A274923(a(n))|) = sup norm of the coordinates of square a(n).

A326924 Squares visited by a knight on a spirally numbered board, moving always to the unvisited square closest to the origin.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 81
Offset: 0

Views

Author

M. F. Hasler, Oct 21 2019

Keywords

Comments

"Closest to the origin" is meant in the sense of Euclidean distance, and in case of a tie, the square coming earliest on the spiral.
Differs from the original A316328 from a(34) = 76 on. See there for more information and other related sequences.
The knight gets trapped at the 22325th move at position (x,y) = (81, -18), from which it can't reach any unvisited square.
Sequence A326922 gives the distance^2 of the square number a(n) visited at move n. - M. F. Hasler, Oct 22 2019
From M. F. Hasler, Nov 04 2019: (Start)
When a(22325) = 25983 at (81, -18) is reached, at distance sqrt(6885) from the origin, the last unvisited square has number 13924, at (-59, 59), distance sqrt(6962) from the origin. This suggests that in an infinite extension (knight moves one step back if no unvisited square is available, cf. A323809) the knight might eventually visit every square. Can this be disproved by a counterexample of a square which will never be visited in the infinite extension? (In A328908 such a counterexample exists even before the knight gets stuck.)
The ratio a(n)/n oscillates between 0.5 and less than 1.7 for all n > 3000, even < 1.5 for all n > 14000, cf. graph of the sequence. What is the superior and inferior limit of this ratio, assuming the infinite extension beyond n = 22325?
(End)

Crossrefs

Cf. A174344, A274923, A296030 (coordinate of square number n).

Programs

  • PARI
    {local(coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n]), U=[]/* used squares */, K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves */, pos(x,y)=if(y>=abs(x),4*y^2-y-x, -x>=abs(y),4*x^2-x-y, -y>=abs(x),(4*y-3)*y+x, (4*x-3)*x+y), t(x, p=pos(x[1],x[2]))=if(p<=U[1]||setsearch(U, p), oo, [norml2(x),p]), nxt(p, x=coords(p))=vecsort(apply(K->t(x+K), K))[1][2]); my(A=List(0)/*list of positions*/); for(n=1, oo, U=setunion(U, [A[n]]); while(#U>1&&U[2]==U[1]+1, U=U[^1]); iferr(listput(A, nxt(A[n])), E, break)); print("Index of last term: ", #A-1); A326924(n)=A[n+1];} \\ To compute the infinite extension, set upper bound in for() loop and replace "break" by listput(A, A[n-1])

A328908 Knight's tour on spirally numbered infinite chessboard, when the knight always jumps on the unvisited square closest to the origin, first according to 1-norm, then 2-norm, then number of the square: a(n) = number of the square visited at the n-th move.

Original entry on oeis.org

0, 9, 2, 5, 8, 3, 6, 1, 4, 7, 10, 13, 28, 31, 14, 11, 26, 23, 44, 19, 22, 43, 40, 17, 34, 37, 18, 15, 32, 29, 52, 25, 46, 21, 76, 47, 50, 27, 12, 33, 16, 39, 20, 45, 24, 51, 48, 77, 114, 73, 70, 105, 38, 35, 60, 93, 30, 53, 84, 49, 78, 115, 74, 41, 68, 103, 36, 61, 94, 57, 54, 85, 124, 175
Offset: 0

Views

Author

M. F. Hasler, Oct 31 2019

Keywords

Comments

Differs from A326924 (where only the 2-norm is considered) from a(73) = 175 on.
The sequence is also finite, when the knight lands on square number a(1092366) there is no unvisited square within reach.
The 1-norm or taxicab distance from the origin of the square a(n) is given in A328928(n).
It appears that this knight's tour would also completely fills the board, if we consider the infinite extension where the knight is allowed to move back on its last step(s) when there's no unvisited square available: no isolated sets of unvisited squares as defined in A323809, seem to occur. Is there a proof or disproof for this? - M. F. Hasler, Nov 04 2019

Examples

			The squares are numbered as in the spiral given in A174344 (upside down to get a counterclockwise spiral, but this is irrelevant here).
The knight starts at a(0) = 0 with coordinates (0, 0).
It jumps to a(1) = 9 with co-ordinates (2, -1): all 8 available squares (+-2, +-1) and (+-1, +-2) are at the same taxicab (2 + 1 = 3) and Euclidean distance (sqrt(2^2 + 1^2) = sqrt(5)) from the origin, but square number 9 has the smallest number.
a(73) = 175 with coordinates (7, 0) is the first destination which is preferred due to the 1-norm (= 7) over A326924(73) = 81 with coordinates (5, -4), having 1-norm 5 + 4 = 9 but Euclidean or 2-norm sqrt(41) smaller than 7.
a(1000) = 816 with coordinates (-10, -14).
a(2000) = 2568 with coordinates (-7, -25).
a(5000) = 4476 with coordinates (21, -33).
a(10000) = 15560 with coordinates (-2, -62).
a(20000) = 19566 with coordinates (-36, 70).
a(50000) = 62092 with coordinates (125, -33).
a(10^5) = 135634 with coordinates (-184, -26), taxicab distance 210 from the origin.
a(200'000) = 259798 with coordinates (47, 255).
a(500'000) = 713534 with coordinates (-68, -422).
a(1'000'000) = 995288 with coordinates (217, 499).
a(1'092'366) = 1165672 with coordinates (188, 540), taxicab norm 728 from the origin, is the last square visited by the knight before there is no unvisited square within reach.
By then the earliest square on the spiral not yet visited is number 629641 at (397, 396), taxicab norm 793, and the unvisited square closest to the origin is number 1794929 at (1, 670), taxicab norm 671.
		

Crossrefs

Cf. A328928 for the "value" (= 1-norm) on the visited square.
Cf. A316328 ~ A316667, A326924, A328909 (variants).
Cf. A174344, A274923, A296030 (coordinates of square number n).

Programs

  • PARI
    {Nmax=1e5;/* Full seq. with > 10^6 terms takes long to compute. */ local( K=[[(-1)^(i\2)<<(i>4),(-1)^i<<(i<5)]|i<-[1..8]], pos(x,y)=if(y>=abs(x),4*y^2-y-x,-x>=abs(y),4*x^2-x-y,-y>=abs(x),(4*y-3)*y+x,(4*x-3)*x+y), coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n]), t(x, p=pos(x[1],x[2]))=if(pt(x+K), K))[1][3], U=0,Umin=0); my(A=List(0)); for(n=1, Nmax, U+=1<<(A[n]-Umin); while(bittest(U,0), U>>=1;Umin++); iferr(listput(A, nxt(A[n])), E, break)); print("Index of the last term: ", #A-1); A328908(n)=A[n+1];}

Formula

A328928(n) = |A174344(a(n))| + |A274923(a(n))|, the 1-norm (or taxicab distance) of the square visited at the n-th step.

A323808 Squares visited by a knight on a spirally numbered board and moving to the lowest available unvisited square at each step and if no unvisited squares are available move one step back.

Original entry on oeis.org

1, 10, 3, 6, 9, 4, 7, 2, 5, 8, 11, 14, 29, 32, 15, 12, 27, 24, 45, 20, 23, 44, 41, 18, 35, 38, 19, 16, 33, 30, 53, 26, 47, 22, 43, 70, 21, 40, 17, 34, 13, 28, 25, 46, 75, 42, 69, 104, 37, 62, 95, 58, 55, 86, 51, 48, 77, 114, 73, 108, 151, 68, 103, 64, 67, 36, 39, 66, 63
Offset: 1

Views

Author

Daniël Karssen, Jan 28 2019

Keywords

Comments

This is an infinite extension of A316667 with which it agrees for the first 2016 terms. - N. J. A. Sloane, Jan 28 2019

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
See A323809 for examples where "backtracking" happens. - _M. F. Hasler_, Nov 06 2019
		

Crossrefs

The sequences involved in this set of related sequences are A316588, A316328, A316334, A316667, A323808, A323809, A323810, and A323811.
Cf. A326924 & A326922 (using L2-norm), A328908 & A328928 (L1-norm), A328909 & A328929 (sup norm); A326916 & A326918 (digits on spiral), A326413 and A328698 (variants with other tie breaker).

Programs

Formula

a(n) = A323809(n-1) + 1. - M. F. Hasler, Nov 06 2019

A326916 Trajectory of the knight's tour for choice of the square with the lowest digit, then closest to the origin, then first in the spiral.

Original entry on oeis.org

0, 11, 14, 31, 28, 51, 10, 13, 34, 95, 190, 247, 312, 385, 244, 133, 242, 239, 376, 301, 372, 233, 370, 295, 232, 173, 228, 367, 230, 171, 226, 223, 358, 285, 220, 355, 282, 217, 352, 283, 218, 115, 44, 73, 20, 71, 40, 17, 36, 15, 18, 3, 12, 1, 22, 75, 46, 117, 48, 77, 24, 79, 50, 81, 118, 221, 286, 225, 292, 229, 296, 451, 298, 235
Offset: 0

Views

Author

M. F. Hasler, Oct 21 2019

Keywords

Comments

A variant of Angelini's "Kneil's Knumberphile Knight", inspired by Sloane's "The Trapped Knight", cf. A316328 and links:
Consider an infinite chess board with squares numbered along the infinite square spiral starting with 0 at the origin (as in A174344, A274923 and A296030). The squares are filled with successive digits of the integers: 0, 1, 2, ..., 9, 1, 0, 1, 1, ... (= A007376 starting with 0). The knight moves at each step to the yet unvisited square with the lowest digit on it, and in case of a tie, the one closest to the origin, first by Euclidean distance, then by appearance on the spiral (i.e., number of the square). This sequence lists the number of the square visited in the n-th move, if the knight starts at the origin, viz a(0) = 0.
It turns out that following these rules, the knight gets trapped at the 1070th move, when he can't reach any unvisited square.
See A326918 for the sequence of visited digits, given as A007376(a(n)).
Many squares, e.g., 2: (1,1), 4: (-1,1), 5: (-1,0), 6: (-1,-1), 7: (0,-1), 8: (1,-1), 9: (2,-1), ..., will never be visited, even in the infinite extension of the sequence where the knight can move back if it gets trapped, in order to resume with a new unvisited square, as in A323809. - M. F. Hasler, Nov 08 2019

Crossrefs

Programs

  • PARI
    {L326916=List(0) /* list of terms */; U326916=1 /* bitmap of used squares */; local( K=vector(8, i, [(-1)^(i\2)<<(i>4), (-1)^i<<(i<5)])/* knight moves */, coords(n, m=sqrtint(n), k=m\/2)=if(m<=n-=4*k^2, [n-3*k, -k], n>=0, [-k, k-n], n>=-m, [-k-n, k], [k, 3*k+n]), pos(x, y)=if(y>=abs(x), 4*y^2-y-x, -x>=abs(y), 4*x^2-x-y, -y>=abs(x), (4*y-3)*y+x, (4*x-3)*x+y), val(x, p=pos(x[1],x[2]))=if(bittest(U326916, p), oo, [A007376(p), norml2(x), p])); iferr( for(n=1,oo, my(x=coords(L326916[n])); U326916+=1<A326916(n)=L326916[n+1]} \\ Requires function A007376; defines function A326916.

A323810 Squares visited by a knight on a diagonally numbered board and moving to the lowest available unvisited square at each step and if no unvisited squares are available move one step back.

Original entry on oeis.org

1, 8, 6, 2, 12, 9, 4, 3, 13, 7, 5, 10, 26, 18, 11, 30, 24, 16, 38, 31, 22, 17, 25, 20, 28, 34, 14, 21, 43, 33, 27, 19, 15, 35, 42, 32, 23, 29, 39, 47, 56, 69, 37, 48, 40, 51, 60, 70, 57, 67, 81, 46, 58, 49, 41, 52, 44, 55, 64, 36, 65, 53, 45, 76, 63, 54, 66, 103, 88, 74, 61
Offset: 1

Views

Author

Daniël Karssen, Jan 28 2019

Keywords

Comments

Board is numbered as follows:
1 2 4 7 11 16 .
3 5 8 12 17 .
6 9 13 18 .
10 14 19 .
15 20 .
21 .
.
Coincides with A316588 for the first 2402 terms. - Daniël Karssen, Jan 30 2019

Crossrefs

The sequences involved in this set of related sequences are A316588, A316328, A316334, A316667, A323808, A323809, A323810, and A323811.

A323811 Squares visited by a knight on a diagonally numbered board and moving to the lowest available unvisited square at each step and if no unvisited squares are available move one step back.

Original entry on oeis.org

0, 7, 5, 1, 11, 8, 3, 2, 12, 6, 4, 9, 25, 17, 10, 29, 23, 15, 37, 30, 21, 16, 24, 19, 27, 33, 13, 20, 42, 32, 26, 18, 14, 34, 41, 31, 22, 28, 38, 46, 55, 68, 36, 47, 39, 50, 59, 69, 56, 66, 80, 45, 57, 48, 40, 51, 43, 54, 63, 35, 64, 52, 44, 75, 62, 53, 65, 102, 87, 73, 60
Offset: 0

Views

Author

Daniël Karssen, Jan 28 2019

Keywords

Comments

Board is numbered as follows:
0 1 3 6 12 17 .
2 4 7 13 18 .
5 10 14 19 .
11 15 20 .
16 21 .
22 .
.
Coincides with A316334 for the first 2402 terms.

Crossrefs

The sequences involved in this set of related sequences are A316588, A316328, A316334, A316667, A323808, A323809, A323810, and A323811.
Showing 1-10 of 10 results.