A018838 Minimum number of steps for a knight to reach (n,n) on an infinite chessboard.
0, 2, 4, 2, 4, 4, 4, 6, 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 16, 16, 16, 18, 18, 18, 20, 20, 20, 22, 22, 22, 24, 24, 24, 26, 26, 26, 28, 28, 28, 30, 30, 30, 32, 32, 32, 34, 34, 34, 36, 36, 36, 38, 38, 38, 40, 40, 40, 42, 42, 42, 44, 44, 44
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
Crossrefs
Cf. A002264.
Programs
-
Magma
[0,2,4] cat [2*Ceiling(n/3): n in [3..80]]; // Vincenzo Librandi, Oct 16 2013
-
Mathematica
Join[{0,2,4},Table[2*Ceiling[n/3],{n,3,70}]] (* Harvey P. Dale, Jul 27 2012 *) CoefficientList[Series[2 x (x^5 - x^4 - x^2 + x + 1)/((x - 1)^2 (x^2 + x + 1)), {x, 0, 100}], x] (* Vincenzo Librandi, Oct 16 2013 *) LinearRecurrence[{1,0,1,-1},{0,2,4,2,4,4,4},70] (* Harvey P. Dale, Nov 03 2019 *)
-
PARI
a(n)=if(n>2, (n+2)\3*2, 2*n) \\ Charles R Greathouse IV, Feb 10 2017
Formula
a(n) = 2*ceiling(n/3) = 2*A002264(n+2), n >= 3.
G.f.: 2*x*(x^5-x^4-x^2+x+1)/((x-1)^2*(x^2+x+1)). - Colin Barker, Oct 04 2012
a(n) = a(n-1) + a(n-3) - a(n-4). - Wesley Ivan Hurt, Feb 21 2025
Comments