### Table of Contents

## Definition of subsets

We introduce some terminologies here to divide the whole set of magic squares into small subsets.

### A magic series and its binary representation

**A magic series of order**is a set of*n**n*distinct integers in the range*[1..n*whose sum is equal to the magic sum^{2}]*( ( n*.^{2}+ 1 ) * n ) / 2- Examples:
- { 2, 9, 4 } is a magic series of order 3.
- { 10, 7, 14, 3 } is a magic series of order 4.

- Any set of distinct positive integers { a
_{1}, a_{2}, a_{3}… } can be represented as an integer whose value is equal to 2^{a1-1}+ 2^{a2-1}+ 2^{a3-1}+ … . We call it the binary representation of a distinct integer set.- Examples:
- { 2, 9, 4 } is represented as 1 0000 1001
_{2}= 0x10b. - { 10, 7, 14, 3 } is represented as 0010 0010 0100 0100
_{2}= 0x2244.

### Order on distinct integer sets

- We can define order on sets of distinct integers in accord with the order of their binary representation.
- Example:
- A magic series { 5, 16, 2, 11 } is greater than { 12, 1, 15, 6 } because their binary representations are 1000 0100 0001 0010 ( = 0x8412 ) and 0100 1000 0010 0001 ( = 0x4821 ), respectively, and 0x8412 > 0x4821.

### Complement of a magic series

If you replace each element *x* of a magic series by * n ^{2} + 1 - x *, the result is also a magic series. We call the resulting set the

**complement**of the original magic series.

- Examples in the case of order 4:
- { 12, 1, 15, 6 } is the complement of { 5, 16, 2, 11 }.
- { 7, 10, 3, 14 } is the complement of itself.

In binary representations, the complement of a magic series is obtained by the bit reverse manipulation.

- Example in the case of order 4:
- The complement of 1000 0100 0001 0010 is 0100 1000 0010 0001.

### The representative magic series of a magic square

Every row and column of a magic square is always a magic series. We define the ** representative magic series ** of a magic square as **the largest magic series which forms a row, a column, the complement of a row, or the complement of a column**. Note that diagonal magic series are not considered a representative magic series.

Example: The representative magic series of a magic square

16 12 1 5 7 3 14 10 9 13 4 8 2 6 15 11

is { 16, 13, 3, 2 } = 0x9006, which forms the complement of the third column.

**We classify magic squares by their representative magic series. This classification is invariant under rotations, reflections, M-transformations, and the complement transformation.
**