OFFSET
1,2
COMMENTS
The coloring of the n X n X n cube is carried out as follows. First, the cubes of the central cross are painted black. For odd cubes, the ends of the central cross are 1 X 1 squares; for even cubes, the ends of the central cross are 2 X 2 squares. Then all the cubes adjacent to black are painted white so that a layer is obtained with all white cubes. At the next step, all cubes adjacent to white are painted black so that a layer of black cubes is obtained, and so on, until all the cubes of the n X n X n cube are painted.
LINKS
Nicolay Avilov, Illustration of initial terms
Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
FORMULA
Let r = n (mod 4), then a(n) = (n^3)/2 if r = 0; (n^3 - 3*n)/2 +2 if r = 1; (n^3)/2 + 4 if r = 2; (n^3 - 3*n)/2 - 2 if r = 3.
G.f.: x*(1 + 6*x - 9*x^2 + 20*x^3 + 7*x^4 - 2*x^5 + x^6)/((-1 + x)^4*(1 + x)^2*(1 + x^2)). - Thomas Scheuerle, Sep 06 2023
EXAMPLE
a(3) = 7;
a(5) = 13 + 44 = 57;
a(9) = 25 +236 + 92 = 353.
MATHEMATICA
LinearRecurrence[{2, 0, -2, 2, -2, 0, 2, -1}, {1, 8, 7, 32, 57, 112, 159, 256}, 50] (* Amiram Eldar, Sep 05 2023 *)
PROG
(PARI) Vec(x*(1 + 6*x - 9*x^2 + 20*x^3 + 7*x^4 - 2*x^5 + x^6)/((-1 + x)^4*(1 + x)^2*(1 + x^2)) + O(x^50)) \\ Thomas Scheuerle, Sep 06 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Nicolay Avilov, Sep 05 2023
STATUS
approved