The answers of Leonid and Mr. Weiser do too much work. In the case of Leonid, only the first three lines are needed. To show this, I changed the last 4 Set
to Equal
s:
In[65]:= len = 4; oldtable = Partition[Partition[Range[len^3], len], len] Out[65]= {{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}, {{17, 18, 19, 20}, {21, 22, 23, 24}, {25, 26, 27, 28}, {29, 30, 31, 32}}, {{33, 34, 35, 36}, {37, 38, 39, 40}, {41, 42, 43, 44}, {45, 46, 47, 48}}, {{49, 50, 51, 52}, {53, 54, 55, 56}, {57, 58, 59, 60}, {61, 62, 63, 64}}} In[66]:= oldtable[[All, All, -1]] = oldtable[[All, All, 1]]; oldtable[[All, -1, All]] = oldtable[[All, 1, All]]; oldtable[[-1, All, All]] = oldtable[[1, All, All]]; oldtable[[All, -1, -1]] == oldtable[[All, 1, 1]] oldtable[[-1, All, -1]] == oldtable[[1, All, 1]] oldtable[[-1, -1, All]] == oldtable[[1, 1, All]] oldtable[[-1, -1, -1]] == oldtable[[1, 1, 1]] Out[69]= True Out[70]= True Out[71]= True Out[72]= True
What Leonid does is illustrated in the figures below. Lines 4-6 of his code do something as shown in the left panel: copying a line (darker color) of an already copied plane (light colors). Line 7 is shown in the right pane. This is a copy of a cell to a cell with diagonally opposite positions, and its action is not included in one of the first three copy actions separately, but is the result of their sequential operation.