cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A018838 Minimum number of steps for a knight to reach (n,n) on an infinite chessboard.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Apparently also the minimum number of steps of the (1,3)-leaper to reach (2n,0) starting at (0,0). The (1,3)-leaper cannot reach (2n+1,0). - R. J. Mathar, Jan 05 2018

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