User Tools

Site Tools


defintion_of_subsets

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 n is a set of n distinct integers in the range [1..n2] whose sum is equal to the magic sum ( ( n2 + 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 { a1, a2, a3 … } can be represented as an integer whose value is equal to 2a1-1 + 2a2-1 + 2a3-1 + … . We call it the binary representation of a distinct integer set.
    • Examples:
      • { 2, 9, 4 } is represented as 1 0000 10012 = 0x10b.
      • { 10, 7, 14, 3 } is represented as 0010 0010 0100 01002 = 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 n2 + 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.

defintion_of_subsets.txt · Last modified: 2024/09/07 11:58 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki