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.

A378902 a(n) is the number of paths of a chess king on square a1 to reach a position outside an 8 X 8 chessboard after n steps.

This page as a plain text file.
%I A378902 #16 May 18 2025 12:31:13
%S A378902 5,6,39,156,922,5060,31165,196605,1301490,8844147,61504902,434181564,
%T A378902 3098427480,22270496859,160854381441,1165549608378,8463549600999,
%U A378902 61543303627788,447926999731974,3262077526200660,23765765966223849,173189189528260281,1262299887268848702,9201356346994752339
%N A378902 a(n) is the number of paths of a chess king on square a1 to reach a position outside an 8 X 8 chessboard after n steps.
%C A378902 The king visits the Moore neighborhood, and the 8 possible moves relative to its current position are E, NE, N, NW, W, SW, S, and SE.
%H A378902 Ruediger Jehn, <a href="/A378902/b378902.txt">Table of n, a(n) for n = 1..100</a>
%e A378902 a(1) = 5: only the 3 moves E, NE, and N end on target squares on the chessboard, the other 5 leave the board.
%e A378902 a(2) = 6: the 6 combinations of step directions leaving the board in exactly 2 moves are [E,SW], [E,S], [E,SE], [N,NE], [N,E], and [N,SE].
%t A378902 LinearRecurrence[{9, 9, -159, -108, 810, 900, -513, -729, -27, 81}, {5, 6, 39, 156, 922, 5060, 31165, 196605, 1301490, 8844147}, 25] (* _Hugo Pfoertner_, May 17 2025 *)
%o A378902 (Python)
%o A378902 from numpy import ones, array
%o A378902 P = ones((11,11),dtype=int) # transition matrix, a1=0, b1=1, c1=2, d1=3, b2=4, c2=5, d2=6, c3=7, d3=8, d4=9, off board=10
%o A378902 P = [[0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 5, ],
%o A378902      [1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 3, ],
%o A378902      [0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 3, ],
%o A378902      [0, 0, 1, 1, 0, 1, 2, 0, 0, 0, 3, ],
%o A378902      [1, 2, 2, 0, 0, 2, 0, 1, 0, 0, 0, ],
%o A378902      [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, ],
%o A378902      [0, 0, 1, 2, 0, 1, 1, 1, 2, 0, 0, ],
%o A378902      [0, 0, 0, 0, 1, 2, 2, 0, 2, 1, 0, ],
%o A378902      [0, 0, 0, 0, 0, 1, 2, 1, 2, 2, 0, ],
%o A378902      [0, 0, 0, 0, 0, 0, 0, 1, 4, 3, 0, ],
%o A378902      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]]
%o A378902 pop = array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=object) # king starts in a1
%o A378902 cycle = 100  # simulation period
%o A378902 for i in range(cycle):
%o A378902     pop = pop @ P
%o A378902     print(i+1, pop[10]) # _Ruediger Jehn_, May 17 2025
%Y A378902 Cf. A140518, A376609, A376610, A377018.
%K A378902 nonn,walk
%O A378902 1,1
%A A378902 _Hugo Pfoertner_, Dec 10 2024
%E A378902 a(16) and beyond from _Ruediger Jehn_, May 17 2025