This example shows the steps that create a 7x7 associative magic square.
Directed pair swapping is the primary tool used in this construction method.
The goal is to have each of the required magic lines attain the magic sum.
The parameter to be measured is the sum of the deviation of each of the required magic lines from their magic sums. The best pair swap is known precisely by examining the effect of all possible swaps on this deviation. For the 7x7 square that implies that 48 + 47 + 46 ..or all possible 1176 swaps are evaluated. In this example for a 7x7 associative magic square a random number generator initially provides half of the values for the square. The complement of those numbers supplies the other half of the values. The associative property is preserved throughout the computation. This program absolutely requires swapped cells to be put on "time out" from future swaps for a few cycles (the TABU function).
to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.