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.

A356359 Square array T(m,n) read by antidiagonals: T(m,n) = number of ways a knight can reach (0, 0) from (m, n) on an infinite chessboard while always decreasing its Manhattan distance from the origin, for nonnegative m, n.

This page as a plain text file.
%I A356359 #64 Mar 23 2025 17:42:03
%S A356359 1,0,0,0,0,0,0,1,1,0,2,2,0,2,2,4,2,4,4,2,4,4,6,9,6,9,6,4,12,17,14,17,
%T A356359 17,14,17,12,34,35,35,40,36,40,35,35,34,70,74,84,86,90,90,86,84,74,70,
%U A356359 148,170,185,195,205,206,205,195,185,170,148
%N A356359 Square array T(m,n) read by antidiagonals: T(m,n) = number of ways a knight can reach (0, 0) from (m, n) on an infinite chessboard while always decreasing its Manhattan distance from the origin, for nonnegative m, n.
%C A356359 The sequence has eight-fold symmetry, since T(m,n) = T(n,m) and T(m,n) = T(|m|, |n|).
%H A356359 Johan Westin, <a href="/A356359/b356359.txt">Table of n, a(n) for n = 0..20099</a> (the first 200 antidiagonals).
%F A356359 T(m, n) = T(m-2, n+1) + T(m-2, n-1) + T(m-1, n-2) + T(m+1, n-2) for m, n >= 2.
%F A356359 T(1, n) = T(-1, n-1) + T(0, n-2) + T(2, n-2).
%F A356359 T(0, n) = 2*T(1, n-2).
%e A356359 There are no knight's moves from (0, 1) which decrease the Manhattan distance, so T(0, 1) = 0.
%e A356359 From (1, 3) you can reach the origin by (-1, 2) -> (0, 0) or (2, 1) -> (0, 0), hence T(1, 3) = 2.
%e A356359 From (2, 3) the possible routes are:
%e A356359   (0, 4) -> (-1, 2) -> (0, 0)
%e A356359   (0, 4) -> (1, 2) -> (0, 0)
%e A356359   (3, 1) -> (1, 2) -> (0, 0)
%e A356359   (3, 1) -> (2, -1) -> (0, 0)
%e A356359 Hence T(2, 3) = 4.
%e A356359 Array begins:
%e A356359       m=0    1    2     3     4      5      6      7       8       9      10
%e A356359      +---------------------------------------------------------------------------
%e A356359   n=0|  1,   0,   0,    0,    2,     4,     4,    12,     34,     70,    148, ...
%e A356359     1|  0,   0,   1,    2,    2,     6,    17,    35,     74,    170,    389, ...
%e A356359     2|  0,   1,   0,    4,    9,    14,    35,    84,    185,    412,    929, ...
%e A356359     3|  0,   2,   4,    6,   17,    40,    86,   195,    445,   1013,   2284, ...
%e A356359     4|  2,   2,   9,   17,   36,    90,   205,   466,   1058,   2406,   5491, ...
%e A356359     5|  4,   6,  14,   40,   90,   206,   476,  1097,   2525,   5761,  13140, ...
%e A356359     6|  4,  17,  35,   86,  205,   476,  1112,  2566,   5914,  13648,  31273, ...
%e A356359     7| 12,  35,  84,  195,  466,  1097,  2566,  6002,  13884,  32115,  74129, ...
%e A356359     8| 34,  74, 185,  445, 1058,  2525,  5914, 13884,  32428,  75304, 174436, ...
%e A356359     9| 70, 170, 412, 1013, 2406,  5761, 13648, 32115,  75304, 176026, 409435, ...
%e A356359    10|148, 389, 929, 2284, 5491, 13140, 31273, 74129, 174436, 409435, 957106, ...
%o A356359 (Python)
%o A356359 from functools import cache # requires Python 3.9
%o A356359 KNIGHT_MOVES = ((1, 2), (2, 1), (-1, 2), (-2, 1),
%o A356359                 (1, -2), (2, -1), (-1, -2), (-2, -1))
%o A356359 def manhattan(x, y):
%o A356359     return abs(x) + abs(y)
%o A356359 @cache
%o A356359 def A356359(m, n):
%o A356359     if (m, n) == (0, 0):
%o A356359         return 1
%o A356359     value = 0
%o A356359     for move in KNIGHT_MOVES:
%o A356359         new_m, new_n = m + move[0], n + move[1]
%o A356359         if manhattan(new_m, new_n) < manhattan(m, n):
%o A356359             value += A356359(new_m, new_n)
%o A356359     return value
%Y A356359 Cf. A018838, A120399.
%K A356359 nonn,tabl,walk,easy
%O A356359 0,11
%A A356359 _Johan Westin_, Nov 10 2022