Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Aug 17 2018 21:06:23
%S 0,50,12,18,24,14,20,10,16,22,52,58,128,134,60,54,124,78,160,70,76,
%T 158,152,66,140,146,68,62,136,130,232,122,164,74,156,266,72,150,64,
%U 138,56,126,80,162,276,154,264,406,144,250,388,242,236,370,228,166
%N Squares visited by a (2,4)-leaper on a spirally numbered board and moving to the lowest available unvisited square at each step.
%C Board is numbered with the square spiral:
%C .
%C 16--15--14--13--12
%C | |
%C 17 4---3---2 11 .
%C | | | |
%C 18 5 0---1 10 .
%C | | |
%C 19 6---7---8---9 .
%C |
%C 20--21--22--23--24--25
%C .
%C The sequence is finite: at step 2015, square 8398 is visited, after which there are no unvisited squares within one move.
%H Daniël Karssen, <a href="/A317619/b317619.txt">Table of n, a(n) for n = 0..2015</a>
%H Daniël Karssen, <a href="/A317619/a317619.svg">Figure showing the first 29 steps of the sequence</a>
%H Daniël Karssen, <a href="/A317619/a317619_1.svg">Figure showing the complete sequence</a>
%F a(n) = A317620(n+1) - 1.
%t 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]; Block[{nn = 30, j = {2, 4}, k = 0, t}, t = spiral[nn]; (k - 1) + Nest[Function[{a}, Append[a, SelectFirst[Sort@ Map[{t[[##]], ##} & @@ {#1 + a[[-1, 2]], #2 + a[[-1, 3]]} & @@ # &, Join @@ Inner[Times, Tuples[{-1, 1}, {2}], Permutations[j], List]], FreeQ[a[[All, 1]], First[#] ] &]]], {{1, nn, nn}}, 55][[All, 1]] ] (* _Michael De Vlieger_, Aug 02 2018 *)
%Y Cf. A317620, A317621.
%K nonn,fini,full
%O 0,2
%A _Daniël Karssen_, Aug 01 2018