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.

A035286 Number of ways to place a non-attacking white and black king on n X n chessboard.

This page as a plain text file.
%I A035286 #34 Jun 02 2025 16:49:53
%S A035286 0,0,32,156,456,1040,2040,3612,5936,9216,13680,19580,27192,36816,
%T A035286 48776,63420,81120,102272,127296,156636,190760,230160,275352,326876,
%U A035286 385296,451200,525200,607932,700056,802256,915240,1039740,1176512,1326336
%N A035286 Number of ways to place a non-attacking white and black king on n X n chessboard.
%C A035286 A legal position is such that the kings are not on (horizontal, vertical or diagonal) neighboring squares.
%C A035286 For n < 3 this is not possible, for n >= 3 a king on the corner, border or elsewhere on the board takes away 4, 6 resp. 9 allowed squares from the n X n board, which yields the formula. - _M. F. Hasler_, Nov 17 2021
%H A035286 Vincenzo Librandi, <a href="/A035286/b035286.txt">Table of n, a(n) for n = 1..1000</a>
%H A035286 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (5,-10,10,-5,1).
%F A035286 a(n) = n^4 - 9 n^2 + 12 n - 4.
%F A035286 G.f.: x^3*(8 - x - x^2)/(1 - x)^5. - _Colin Barker_, Jan 09 2013
%F A035286 a(n) = (n - 1) (n - 2) (n^2 + 3 n - 2). - _M. F. Hasler_, Nov 17 2021
%F A035286 a(n) = 5*a(n-1) - 10*a(n-2) + 10*a(n-3) - 5*a(n-4) + a(n-5) - _Natalia L. Skirrow_, Oct 11 2022
%e A035286 There are 32 ways of putting 2 distinct kings on a 3 X 3 board so that neither can capture the other.
%e A035286 From _M. F. Hasler_, Nov 17 2021: (Start)
%e A035286 The first nonzero term occurs for n = 3 where we have the possibilities
%e A035286    K  x  O           x K x
%e A035286    x  x  O    and    x x x    and rotations of these by +-90 degrees and 180 degrees,
%e A035286    O  O  O           O O O
%e A035286 where 'x' are forbidden squares, and 'O' are squares the opposite king can be placed on. This yields the a(3) = 4*(5 + 3) = 32 possibilities. (End)
%t A035286 CoefficientList[Series[4 x^2 (x^2 + x - 8)/(x - 1)^5, {x, 0, 40}], x] (* _Vincenzo Librandi_, Oct 20 2013 *)
%o A035286 (Magma) [n^4 - 9*n^2 + 12*n - 4: n in [1..40]]; // _Vincenzo Librandi_, Oct 20 2013
%o A035286 (PARI) apply( {A035286(n)=n^4-9*n^2+12*n-4}, [1..99]) \\ _M. F. Hasler_, Nov 17 2021
%K A035286 nonn,easy
%O A035286 1,3
%A A035286 _Erich Friedman_