A183041 Least number of knight's moves from (0,0) to (n,1) on infinite chessboard.
3, 2, 1, 2, 3, 4, 3, 4, 5, 6, 5, 6, 7, 8, 7, 8, 9, 10, 9, 10, 11, 12, 11, 12, 13, 14, 13, 14, 15, 16, 15, 16, 17, 18, 17, 18, 19, 20, 19, 20, 21, 22, 21, 22, 23, 24, 23, 24, 25, 26, 25, 26, 27, 28, 27, 28, 29, 30, 29, 30, 31, 32, 31, 32, 33, 34, 33, 34, 35, 36
Offset: 0
Keywords
Examples
a(0)=3 counts (0,0) to (2,1) to (1,3) to (0,1).
Programs
-
Python
def a(n): if n < 2: return [3, 2][n] m, r = divmod(n, 4) return [2*m+1, 2*m+2][r%2] print([a(n) for n in range(70)]) # Michael S. Branicky, Mar 02 2021
Formula
T(0,1)=3, T(1,1)=2, and for m>=1,
T(4m-2,1)=2m-1, T(4m-1,1)=2m, T(4m,1)=2m+1, T(4m+1,1)=2m+2.
G.f.: (2*x^5-2*x^4+x^3-x^2-x+3) / ((x-1)^2*(x+1)*(x^2+1)). - Colin Barker, Feb 19 2014
Comments