Some Transforms

Terms

Some terms used below:

opposite row/column
the row/column at the same offset from the opposite side of the square
Example: For order 5, the opposite of 1 is 5 and the opposite of 2 is 4.
same side row/column
from the first to the middle or the middle to the last, not including the middle for odd order squares

Transform 1

Swap any row with its opposite; then swap like columns.

Swapping the rows re-arranges the column cells, but the column sums don't change. However, it moves cells between the main diagonals, so their sums can be different. Then, swapping the columns re-arranges the row cells, but the row sums don't change. And, it moves cells back to their original diagonals, restoring the diagonal sums.

Transform 2

Swap any two same side rows, and swap the opposite two rows; then swap like columns.

Swapping the rows re-arranges the column cells, but the column sums don't change. However, it moves different cells into the main diagonals, so their sums can be different. Then, swapping the columns re-arranges the row cells, but the row sums don't change. And, it moves cells back to their original diagonals, restoring the diagonal sums.

Repeat Transforms

For large squares, many rows and columns can be swapped by repeating transform 1 and/or transform 2. A program to do repeated transforms 1 and/or 2 can be downloaded.

The number of squares that can be made with repeated transforms is 4 for orders 4 and 5, 24 for orders 6 and 7, and grows rapidly with order n. For orders 20 and 21, the number is 1,857,945,600.

The formula for even order n >= 4 is (n/2) × (n-2) × (n-4) × ... × 2 or 2(n-2)/2(n/2)!.
For odd order n, the number is that for n - 1.

A program to make (a sample of) all the possible transformed squares can be downloaded.

Complement

Replace each number in the square with its complementary number. See definitions and discussion by Harvey Heinz and Mitsutoshi Nakamura. A program to complement squares can be downloaded. The complementary pair sum used is "the smallest number" + "the biggest number" in the square. This differs from Heinz and Nakamura but gives the same result for normal magic squares. And, it accomodates other number squares including squares that contain repeated numbers.

Associative <> Pandiagonal Complete

For doubly even orders, associative squares can be transformed to and from pandiagonal complete squares. See Planck's A-D method.

AssocPan does these transformations.

Note: To ensure a distinct result from each input square, the program chooses an appropriate aspect of the square. See notes.

Most-perfect to Franklin

For orders 8k, k=1,2,3,..., most-perfect squares can be transformed to Franklin magic squares.

Most-perfectToFranklin does these transformations.

Note: The reverse transform is not implemented. Except for order 8, there are many more Franklin magic squares than most-perfect squares. This requires more than one transform to most-perfect. See Order 16.

Reversible <> Most-perfect

For doubly even orders, reversible squares can be transformed to and from most-perfect squares. See Ollerenshaw and Brée.

ReversibleMost-perfect does these transformations.

Note: To ensure a distinct result from each input square, the program chooses an appropriate aspect of the square. See notes.

Reversible to Associative

For doubly even orders, reversible squares can be transformed to associative squares.

ReversibleToAssociative does these transformations. Reverse transforms, i.e., from associative to reversible, are not implemented.

Reversible to Franklin Magic

For orders 8k, k=1,2,3,..., reversible squares can be transformed to Franklin magic squares.

ReversibleToFranklin does these transformations. Reverse transforms, i.e., from Franklin magic to reversible, are not implemented.