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
- M. F. Hasler, Table of n, a(n) for n = 0..1069
- Eric Angelini, Kneil's Knumberphile Knight, Cinquante signes, May 04 2019.
- Eric Angelini, Kneil's Knumberphile Knight, Cinquante signes, May 04 2019. [Cached copy, pdf file, with permission]
- M. F. Hasler, Knight tours, OEIS wiki, Nov. 2019.
- N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (2019)
-
{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.
A326931
a(n) is the end square spiral number for a knight starting on square n moving on a board with squares numbered with the square of their distance from the 0-square origin and where the knight moves to the smallest numbered unvisited square; the smallest spiral number ordering is used if the distances are equal.
Original entry on oeis.org
25984, 51159, 8224, 31440, 8224, 31440, 8224, 110081, 131178, 92879, 69289, 59225, 62391, 10042, 66686, 73825, 36212, 123343, 158628, 28616, 74166, 98142, 59386, 50028, 42525, 15828, 7092, 27981, 57726, 27313, 52761, 15586, 47169, 17233, 152620, 73042, 76303, 83957, 59892, 9567
Offset: 1
a(1) = 25984. See A326922.
- Scott R. Shannon, Table of n, a(n) for n = 1..20000
- Scott R. Shannon, Path for starting square n = 72000. This has the largest found end square spiral number of 574108. In this and other images a green square marks the starting square, a red square the ending square, and blue squares mark the eight blocking squares for the end square. The end square is on the edge at about 12:30 on a clock.
- Scott R. Shannon, Path for starting square n = 103623. This is trapped after 483425 steps, the largest found value. The end square is on the edge at about 6:30 on a clock.
- Scott R. Shannon, Path for starting square n = 1284. This has the smallest found end square spiral number of 1143. Note that the start square acts as one of the eight blocking squares for the end square.
- Scott R. Shannon, Path for starting square n = 633. This is trapped after 1127 steps, the smallest found value.
- N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (2019).
A357046
Squares visited by a knight moving on a board covered with horizontal dominoes [m|m], m = 0, 1, 2, ... in a diamond-shaped spiral, when the knight always jumps to the unvisited square with the least number on the corresponding domino.
Original entry on oeis.org
0, 11, 14, 1, 4, 13, 10, 3, 18, 7, 2, 5, 22, 9, 28, 31, 60, 15, 32, 29, 52, 25, 8, 27, 12, 53, 26, 23, 6, 17, 34, 59, 30, 87, 126, 51, 24, 45, 20, 39, 16, 33, 58, 55, 86, 125, 50, 47, 76, 21, 40, 67, 36, 61, 94, 57, 54, 85, 176, 129, 56, 93, 138, 187, 92, 137, 96, 35, 38, 19
Offset: 0
The knight hops from the left 0 (= the origin) on the right 1, then on the left 2, then on the right 0, then on the left 3, then on the right 2, etc.
The list of these labels would be 0, 1, 2, 0, 3, 2, 8, 3, 4, 5, 1, 4, 6, 7, 9, 11, 12, 14, 11, 10, 24, 22, 7, 8, 10, 9, 23, 6, 5, 15, 13, 12, 27, 26, 48, 23, ...
As explained in comments, the terms a(n) correspond to the (unique) "square spiral numbers" of these locations (cf. A274641 or A174344 (upside down) or A316328).
- Eric Angelini, Spirals for Scott, Blog entry, Oct. 19, 2022.
- Eric Angelini, Spirals for Scott, Blog entry, Oct. 19, 2022 [Local copy, with permission].
- M. F. Hasler, Plot of the knight's tour A357046, Oct 20 2022.
-
/* function domino([x,y]) gives the label m on the domino at (x,y); it uses the map DOM to store this label with key x + i*y. */
DOM=Map(); {domino(x)=while(!mapisdefined(DOM, x[1]+I*x[2], &x), my(M=#DOM\2, side=sqrtint(M*4-!!M), pos=sqrtint(M)*I^(side-1)+side\/2%2*I, dir=(1+I)*I^side); for(m=M, M+side\2, mapput(DOM, pos, m); mapput(DOM, pos+1, m); pos+=dir)); x}
{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])}
{local(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, [domino(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); A357046(n)=A[n+1];} \\ same code as A326924 except for norml2 => domino
/* to get the sequence of labels m (cf.example): */
[domino(coords(A357046(n))) | n <- [0..99]]
Comments