OFFSET
0,3
COMMENTS
For example, take this n=3 grid:
.................BCF..........................
ABC.....ABCF.....AHI.....BCFI......CFI.....CFIL
DEF.-->.DEHI.-->.DEL.-->.AHEL.-->..BEL.-->.BEHK (done)
GHI.....GJKL.....GJK.....DGJK......AHK.....ADGJ
JKL................................DGJ.........
The diagonal in the leftmost arrangement is the line beginning between G and J and ending between C and F. The triangle containing F, H, I, J, K AND L is moved to the upper right (counterclockwise with respect to the letters that aren't moving). All subsequent moves apply the same rule, only rotated 90 degrees counterclockwise compared to the previous move.
All the elements on the outer ring stay on the outer ring and they seem to be walking (or rotating) in one direction. For a rectangle of 3 X 4, there are 2((width-1)+(height-1)) = 10 elements on the outer ring. Being symmetric over 180 degrees, after 5 of these outer-ring rotations, the pattern seems identical.
A matrix of 5 X 6 elements has a core of the same shape as a 3 X 4 matrix, with a 'ring' added around it. As this core undergoes exactly the same permutations during each shift as a separate 3 X 4 matrix, this means that the total number of moves must be a multiple of 5.
Because the outer ring now contains 18 elements, this total number of moves must also be a multiple of 9. The generator must be one that takes (or calculates) the numbers 5 and 9 and finds the smallest number that divides by both 5 and 9. Such a formula is 5*9/gcd(5,9). The number of rotations on the outer ring is 2*((width-1)+(height-1))/2 = 2n-1. The total number of moves of matrix under the 'shell' is f(n-2).
FORMULA
a(0) = 1 a(1) = 1 a(n) = a(n-2) * (2n-1) / gcd(a(n-2), 2n-1).
CROSSREFS
KEYWORD
nonn
AUTHOR
Mark Jeronimus, Mar 31 2006
STATUS
approved