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.
%I A166540 #25 Sep 08 2022 08:45:48 %S A166540 0,0,0,193,1548,6714,21280,55395,125748,257908,489024,870885,1473340, %T A166540 2388078,3732768,5655559,8339940,12009960,16935808,23439753,31902444, %U A166540 42769570,56558880,73867563,95379988,121875804,154238400,193463725,240669468,297104598,364159264 %N A166540 Number of ways to place 2 nonattacking kings on an n X n X n raumschach board. %C A166540 We consider that kings "attack" any square that differs by at most one in any combination of the indices from its current space. A logical extension of sequence A061995. %H A166540 Andrew Woods, <a href="/A166540/b166540.txt">Table of n, a(n) for n = 0..1000</a> %H A166540 Wikipedia, <a href="https://en.wikipedia.org/wiki/Three-dimensional_chess">Three-dimensional chess</a> %H A166540 <a href="/index/Rec#order_07">Index entries for linear recurrences with constant coefficients</a>, signature (7,-21,35,-35,21,-7,1). %F A166540 a(n) = (n^6 - (3*n-2)^3) / 2 = (n^6)/2 - (27*n^3)/2 + 27*n^2 - 18*n + 4 for n>0. - _Andrew Woods_, Aug 30 2011 %F A166540 G.f.: x^3*(193 +197*x -69*x^2 +35*x^3 +4*x^4)/(1-x)^7. - _Colin Barker_, Jan 09 2013 %F A166540 E.g.f.: (8 -8*x +4*x^2 +63*x^3 +65*x^4 +15*x^5 +x^6)*exp(x)/2 -4. - _G. C. Greubel_, Apr 03 2019 %t A166540 LinearRecurrence[{7,-21,35,-35,21,-7,1}, {0, 0, 0, 193, 1548, 6714, 21280, 55395}, 35] (* _G. C. Greubel_, May 16 2016; a(7) appended by _Georg Fischer_, Apr 03 2019 *) %o A166540 (Python) # Two non-attacking kings in n x n x n cubic "board" . %o A166540 m=int(input('What\'s the biggest board to investigate? ')) %o A166540 for n in range (0, m+1): %o A166540 sum=0 %o A166540 for x1 in range (1, n+1): %o A166540 for y1 in range (1, n+1): %o A166540 for z1 in range (1, n+1): %o A166540 for x2 in range (1, n+1): %o A166540 for y2 in range (1, n+1): %o A166540 for z2 in range (1, n+1): %o A166540 if abs(x1-x2)>1 or abs(y1-y2)>1 or abs(z1-z2)>1: %o A166540 sum=sum+1 %o A166540 sum=sum//2 %o A166540 print(n, sum) %o A166540 (PARI) {a(n) = if(n==0,0, (n^6 -(3*n-2)^3)/2)}; \\ _G. C. Greubel_, Apr 03 2019 %o A166540 (Magma) [0] cat [(n^6 -(3*n-2)^3)/2: n in [1..35]]; // _G. C. Greubel_, Apr 03 2019 %o A166540 (Sage) [0]+[(n^6 -(3*n-2)^3)/2 for n in (1..35)] # _G. C. Greubel_, Apr 03 2019 %Y A166540 Cf. A061995, A194605. %K A166540 nonn,easy %O A166540 0,4 %A A166540 _Michael Engling_, Oct 16 2009