[go: up one dir, main page]

login
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.
11
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,2
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
LINKS
Eric Angelini, Kneil's Knumberphile Knight, Cinquante signes, May 04 2019.
M. F. Hasler, Knight tours, OEIS wiki, Nov. 2019.
N. J. A. Sloane and Brady Haran, The Trapped Knight, Numberphile video (2019)
PROG
(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<<listput(L326916, vecsort([val(x+D)|D<-K])[1][3])), E, printf("Final square at index %d.", #L326916-1)); A326916(n)=L326916[n+1]} \\ Requires function A007376; defines function A326916.
KEYWORD
nonn,base,fini,full
AUTHOR
M. F. Hasler, Oct 21 2019
STATUS
approved