$\begingroup$

Suppose the path-avoiding snail walks along the grid according to the following algorithm:

At each step, the snail steps unit distance if doing so will not collide with its trail. If a step of unit distance will collide with the trail, the snail moves half way toward the trail. After each step, the snail turns right or left or remains straight.

Let $a(n)$ be the minimal number of steps required before the snail can have a step size of $(2n-1)/2^k$ for some $k$ such that the fraction is reduced.

Here are a few examples of minimal walks (solved by brute force):

This shows that you can have a step size with numerator $3$ in $7$ steps, numerator $5$ in $9$ steps, numerator $7$ in $8$ steps, and numerator $9$ in 10 steps—therefore $a(2) = 7$, $a(3) = 9$, $a(4) = 8$ and $a(5) = 10$.

Is there a general strategy of determining $a(n)$?

Also, given a random walk (where the turns are chosen uniformly at random) what is the expected number of steps before the snail takes a step of $(2n-1)/2^k$ for some $k$?

Known values (assuming the implementation is correct):

a(2) = 7 a(9) = 11 a(16) = 10 a(23) = 12 a(30) = 13 a(3) = 9 a(10) = 12 a(17) = 12 a(24) = 13 a(31) = 12 a(4) = 8 a(11) = 11 a(18) = 13 a(25) = 12 a(32) = 11 a(5) = 10 a(12) = 12 a(19) = 14 a(26) = 13 a(33) = 13 a(6) = 11 a(13) = 11 a(20) = 13 a(27) = 14 a(34) = 14 a(7) = 10 a(14) = 12 a(21) = 13 a(28) = 13 a(35) > 14 a(8) = 9 a(15) = 11 a(22) = 14 a(29) = 12

Here are some walks for $n=20$, $n=21$, and $n=22$: