Freeware Disclaimer

The software on this site may be used freely.
You should use only if you agree to the freeware disclaimer. To download and run a program, (for example, Associative):

find Associative below and click - for Netscape
select Save File, click OK
open the folder with the downloaded Associative.zip
double click Associative.zip

- for Google Chrome
click the down arrow near the Discard button, click Keep
click Associative.zip

- for Internet Explorer
click Save
click Open folder
double click Associative.zip

- for Opera
click Save, click Save
double click Associative.zip

- for Safari
click Save
in the Downloads window, double click Associative.zip

In the pop-up window, click and drag Associative.exe to the desktop or another folder
double click Associative.exe To make a copy of a console:
Click the upper left corner button, and Edit, Select All.
Click the upper left corner button, and Edit, Copy.
Paste to a text file.

To paste input, such as, a file name, into a console:
Copy the file name from somewhere.
Click the upper left corner button, and Edit, Paste.

There are source code files and Win32 applications for the programs described below.

Note: Run times are for a 3.0 GHz PC. Makes adjacent corner pair magic squares. Output files are in folder AdjacentCornerSquares[_n]. Makes adjacent side pair magic squares. Output files are in folder AdjacentSideSquares[_n]. Associative

AssociativeSquares C code
Makes associative magic squares. For singly-even order the squares are near-associative. Output files are in folder AssociativeSquares[_n]. Block

BlockSquares C code
Makes block magic squares. Prime order squares are made with 1 or 2 borders. Singly-even order squares are also currently made with a border. Output .txt and .html files are in folder BlockSquares[_n].
For each order n square, the .txt file contains the quotient Q, followed by the remainder R, followed by the square S, where S[r][c] = n x Q[r][c] + R[r][c] + 1. Bordered

BorderedSquare C code
Makes bordered magic squares. Makes one square of each order. All these squares have zero water retention. Output files are in folder BorderedSquare[_n]. BorderedSquare1 C code
An earlier version using an algorithm developed for the HP-41C pocket calculator. The odd order squares are the same as made by BorderedSquare, but the even squares are different, (not zero water retention). Output files are in folder BorderedSquare[_n]. BorderedSquares C code
Makes bordered magic squares. Makes many distinct squares by randomly:
• arranging row and column value pairs, (except corners)
• rotating each border and the center
• selecting one of the 880 4x4s as center for even order squares

Output files are in folder BorderedSquares[_n]. BorderedSquares1 C code
An earlier version that made many fewer distinct squares, only randomly rotating each nested border and the center. Output files are in folder BorderedSquares[_n]. Bordering

BorderingSquares C code
Makes bordering magic squares. Output files are in folder BorderingSquares[_n]. Composite

CompositeSquares C code
Makes composite magic or Latin squares of order mn from input squares of order m and order n. Output files are in folder <M>-<N>-CompositeSquares[_n]. CompositeCalligraphy C code
Makes squares showing the content of text files as retained water. See notes.

Each square is a composite of order mn made from magic character squares of order m and a square of order n. Order m = 11 and order n is calculated as the greater of:

• the longest text line
• the number of lines

The character squares are contained in the program. Optionally, the program also supplies the order n square, which will be a zero retention square. If order n is not 2, the square is magic. If the order n square is magic, the composite is magic. Output files are in folder <M>-<N>-Composite[_n].

Hint: The character squares can be viewed, (in output file Characters.html), by entering a single character in the text file. Franklin

FranklinMagicSquares C code
Makes Franklin magic squares. Output files are in folder FranklinNormalMagicSquares[_n]. Magic

MagicSquares C code
This program makes magic squares. The square type can be specified as semimagic, magic, associative, concentric, or pandiagonal. Pandiagonal succeeds only for small orders. Also makes magic and associative non-square rectangles, (input order as two numbers). See notes and CompleteSquare. The output file is <N>x<N><square type>[_n].txt. Most-perfect

Most-perfectSquares C code
Makes most-perfect magic squares. Output files are in folder Most-perfectSquares[_n]. Pandiagonal

PandiagonalSquares C code
Makes pandiagonal magic squares. For singly-even order the squares are near-pandiagonal. Output files are in folder PandiagonalSquares[_n]. Reversible

ReversibleSquares C code
Makes principal reversible squares. Writes to the console the number of principal squares made and the calculated number of variations of each and total reversible squares. Output files are in folder ReversibleSquares[_n]. Self-complement

SelfComplementSquares C code
Makes side-to-side symmetric self-complement even order magic squares. Output files are in folder SelfComplementSquares[_n].
To make associative self-complement magic squares, use program AssociativeSquares Latin Squares

LatinSquares C code
Makes Latin squares and diagonal Latin squares of various kinds. See notes. Associative and near-associative are natural order \diagonal. Most other kinds are natural order first row. Output files are in folder LS[_n].

LatinSquaresLT C code
Uses "Constraint-Based Local Search" and "Tabu Search" techniques. See "Water Retention on Magic Squares Solver" by Johan �fverstedt. Makes Latin squares and diagonal Latin squares including associative and pandiagonal. Pandiagonal succeeds only for small orders. The output file is <N>x<N><square type>[_n].txt.

NFR_NBD C code
Converts Latin squares to natural order first row, (nfr), or natural order \diagonal, (nbd). Squares are converted to nbd only if the \diagonal is a transversal. The output file is <in file name>To<NFR|NBD>[_n].txt SODLS

MagicSquaresSODLS C code
Makes self-orthogonal diagonal Latin squares and their magic squares. Input is an order, (one number), or an order range, (two numbers). Output files are in folder SODLS[_n]. Each file contains a SODLS followed by the magic square.

SODLS C code
Makes SODLS for small orders. Optionally makes SSSODLS, "strong symmetric" SODLS. Output files are SODLS<N>[_n] or SSSODLS<N>[_n]. See notes.

SODLS9 C code
Makes order 9 SODLS. Output files are SODLS9[_n]. Uses techniques given in the 2017 paper by Kochemazov, Vatutin, Zaikin. Running 6 programs makes all the 224,832 SODLS with natural order first row in a little over 5 hours on a 3.0 GHz multiprocessor PC.

SODLS10 C code
Makes order 10 SODLS. Output files are SODLS10[_n]. See notes. Uses techniques given in the 2017 paper by Kochemazov, Vatutin, Zaikin. Symlateral

SymlateralSquares C code
Makes symlateral magic squares. Output files are in folder SymlateralSquares[_n]. Zigzag2

Zigzag2Squares C code
Makes zigzag2 magic squares.
For power of 2 orders, (8,16,32,...), optionally makes pandiagonal, complete, compactn/2 squares.
Output files are in folder ZigZag2[_n]. Order 4

Order4 C code
Makes the 880 order 4 magic squares. Output is a .txt file. Order 5

Order5 C code
Makes the 275,305,224 order 5 magic squares.

Files are output in folder Order5[_n]. There are 25 .txt files, one each for the squares with the same center value. The files contain only the squares in a single column. Numbers are separated by white space characters, (blank, newline).

WARNING: The files are large, ranging from 341 MB to 1,492 MB, (total 21 GB). Order5Special C code
Makes special order 5 magic squares. The types made are associative, concentric, bordered, inlaid corner, inlaid side, pandiagonal, ultramagic. Files are output in folder Order5Special[_n]. Order5TopGroups C code
Makes squares of any of the biggest order 5 complement pair pattern groups. These are the 102 groups of more than 5000 squares, (ranging from 228,960 to 5,088). An html file is also made showing the pattern of the group. Input is a group number or number range, (2 numbers separated by a space). Files are output in folder GroupSquares[_n]. Order5Count Time: 3.8 minutes
Computes the number of order 5 magic squares. Only the source code is provided. Order 6 Concentric

Order6C C code
Makes 4x4 center squares and border groups. For an input range of partitions, the output is:
• for each partition that has a 4x4 center square:
• a file of the border groups
• a file of the 4x4 center squares
• a summary file

See Order6CDoc.txt and Order6CExamples.txt. Output files are in folder Order6C[_n]. Order6CSample C code
Makes a sample of the squares. One square is output for each of the center/border partitions, (22,145 squares). Output is a .txt file. Order6Ccount Time: 2.4 minutes
Computes the number of order 6 concentric magic squares, (736,347,893,760). Only the source code is provided. Order 7

Order7Ccount Time: 2 h 32 m
Computes the number of order 7 concentric magic squares, (3,835,791,613,181,952,000). See Order7CDoc.txt. Only the source code is provided.

Order7BentDiagonal Time: 2 h 12 m
Makes the order 7 bentdiagonal magic squares, (21,446). Only the source code is provided. It is adapted from Quick Basic program 7x7BDM-H written by Miguel Angel Amela of Argentina. Order 8

Franklin8 C code
Makes the 368,640 magic and 737,280 semi-magic order 8 Franklin squares. Output files are in folder Order8Franklin[_n].

Most-perfect8 C code
Makes the 368,640 order 8 most-perfect magic squares. Output file is Order8Most-perfectSquares[_n].txt. Utility Programs

Input for these programs is a .txt file containing one or more number squares of the same order. The text file must contain only the square numbers separated by white space characters, (blank, horizontal tab, newline).

You will be prompted first to input the order of the squares, and, then the file name. The file name can be the absolute path name or the path name relative to the folder containing the program. It is not necessary to enter the .txt extension. For example, if program Frenicle is in folder C:\Squares and the file is C:\Squares\order4squares.txt, the file name can be entered as any of:

• C:\Squares\order4squares
• C:\Squares\order4squares.txt
• order4squares
• order4squares.txt Bones C code
Changes squares to or from bones format. Square numbers must be in the range 1 to n² or 0 to n²-1 for sensible results. Output .html file(s) are in folder ToFromBones<N>[_n]. If the input file is large, output may be split into a number of files. CompleteSquare C code
Given an input square with some cell values between 1 and n² specified, (and other cell values 0), this program attempts to complete a magic square by placing the remaining values. The square type can be semimagic, magic, or associative. Non-square rectangles are also supported, (input order as two numbers). See notes. The output file is <N>x<N><square type>[_n].txt.

The program fills the starting square with random placement of unspecified values, and then uses "Constraint-Based Local Search" and "Tabu Search" techniques to transform the square into the indicated type. See "Water Retention on Magic Squares Solver" by Johan �fverstedt.

Thanks to Craig Knecht for pushing the envelope here.

CompleteSquareSteps C code
Similar to CompleteSquare, but, for successful solutions, shows the steps of the computation. The number exchanges at each step and the intermediate squares are written to files. See related animation by Craig Knecht. The maximum number of steps is set at 1000. CopySquaresByNumber C code
Copies squares from a file. Squares to copy are chosen by a number or number range. The output file is Order<N>Copy<num>[_n].txt or Order<N>Copy<num1>to<num2>[_n].txt CopySquaresByType C code
Copies squares from a file. Squares to copy are chosen by include and exclude type lists. The output file is Order<N>Copy[_n].txt Frenicle C code
Puts squares in Frénicle standard form and sorts them in ascending numerical sequence order. The number of duplicate squares is reported and duplicates are not output. The output file is <in file name>Frenicle[_n].txt

Frenicle64 C code
A 64 bit version of Frenicle that can sort much bigger files if enough RAM is available. Requires a little over 9 GB of RAM to sort a single 21 GB file of all the Order5 magic squares. GetMagic C code
Checks if squares are magic. The program classifies each square as normal magic, other magic, or not magic. If the squares are not all of the same class, they are written to separate files: NormalMagic, OtherMagic, NotMagic. The files are written to folder Order<N>Squares[_n]. GetType C code
Checks the type of each square as: not magic, normal semimagic, other semimagic, normal magic, other magic. If the type is normal magic, checks other properties : adjacent corner, adjacent side, associative, concentric, bordered, bordering, symlateral, pandiagonal, ultramagic, complete, compact, bent diagonal, Franklin, zigzag, self-complement, bimagic, trimagic. If the type is normal semimagic also checks appropriate properties in the list.

Also supports non-square rectangles for: not magic, other magic, normal magic, and associative. Input order as two numbers for rectangles.

Also supports Latin square and diagonal Latin square types and properties:
associative, pandiagonal, weakly pandiagonal, ultramagic, axial symmetric, double axial symmetric, center symmetric, orthogonal, self-orthogonal, nfr, nfc, nfr and nfc, natural \diagonal, self-transpose.
Recognized Latin square symbols are the number ranges 0..N-1 and 1..N.

See notes. A result summary is written to the console with details in file <in file name>TypeDetail[_n].txt.

GetTypeNoDetail C code

Same as GetType with summary results written to the console only. Hurkens C code
Puts Franklin squares in Hurkens principal form. The output file is <in file name>Hurkens[_n].txt Rotate C code
Rotates squares to a different aspect chosen by the rotation number:

Number                   Rotation
--------    -----------------------------------------------------
0                       none
1                   clockwise 90°
2                       180°
3                counterclockwise 90°

4       180° about middle vertical or Y axis,   (= mirror)
5       180° about main /diagonal,              (= mirror + 1)
6       180° about middle horizontal or X axis, (= mirror + 2)
7       180° about main \diagonal,              (= mirror + 3)

8                       all SquareSort C code
Sorts squares in ascending numerical sequence order removing duplicate squares. Square aspect is not changed, so duplicates with different aspect are not removed. Compare Frenicle. The output file is <in file name>Sorted[_n].txt

SquareSort64 C code
A 64 bit version of SquareSort that can sort much bigger files if enough RAM is available. SquareSums C code
Computes the sums of rows, columns, pan diagonals, and bent diagonals. Row 1 is at the top, column 1 is on the left, diagonal 1 is always through the corners without wrap around. Rows are numbered top to bottom, columns left to right, \diagonals left to right, /diagonals right to left, and bent diagonals in the direction of the bend. The output file is <in file name>_Sums[_n].txt ZeroOne C code
Converts squares from range 0 .. to 1 .. or vice versa. The range to convert to is indicated by input of 0 or 1. Squares that are already in the selected range are copied unchanged. Squares with smallest value not equal to 0 or 1 are copied unchanged. The output file is <in file name>To<0|1>[_n].txt
Hint: Also useful to format a badly formatted squares file. Transform

Transforms1_2 C code
Transforms squares using transform 1 and/or transform 2. For each squares file, you can do a transform and then opt to do another transform of that transform. If declined, you can opt to do another transform on the original squares. If declined, you can opt to transform another file of squares. The transform is selected by the number of rows entered, (1 or 2).

The flow chart is:

--------------->--------- enter the order
^                                 |
|                        enter the file name
|                                 |
|    ----------->--------- enter the rows(s)
|   ^   ^                         |
|   |   |                   transform squares
|   |   |                         |
|   |    <- YES <- transform transformed squares?
^   ^                             |
|   |                             NO
|   |                             |
|    <----- YES <--- transform original squares?
|                                 |
|                                 NO
|                                 |
<--------- YES <----- transform another file?
|
NO
|
end Transforms1_2All C code
For each square in an input file, makes (a sample of) all possible squares from repeated transform 1 and/or transform 2. Output files are in folder Order<N>XForm[_n]. There is one file for each square in the input file. The first square in each output file is the original square. Complement C code
Makes the complementary squares. The output file is <in file name>Complement[_n].txt.
Self-complement squares are also written to <in file name>SelfComplement[_n].txt AssocPan C code
For doubly even orders, transforms associative magic squares to or from pandiagonal complete magic squares. Pandiagonal complete squares are written to <in file name>P[_n].txt. Associative squares are written to <in file name>A[_n].txt. All squares are output in Frénicle standard form, (unsorted). Most-perfectToFranklin C code
For orders that are a multiple of 8, transforms most-perfect squares to Franklin magic squares. Squares are written in unsorted Frénicle standard form to <in file name>F[_n].txt. ReversibleMost-perfect C code
For doubly even orders, transforms reversible squares to and from most-perfect squares. Most-perfect squares are written to <in file name>MP[_n].txt. Reversible squares are written to <in file name>R[_n].txt. All squares are output in Frénicle standard form, (unsorted). ReversibleToAssociative C code
For doubly even orders, transforms reversible squares to associative squares. Squares are written in unsorted Frénicle standard form to <in file name>A[_n].txt. ReversibleToFranklin C code
For orders that are a multiple of 8, transforms reversible squares to Franklin magic squares. Squares are written in unsorted Frénicle standard form to <in file name>F[_n].txt. Water Retention

WaterRetention C code
Computes and displays the water retention patterns of number rectangles. Input order as two numbers for non-square rectangles. Water retention is an idea of Craig Knecht. The program is based on an algorithm of Gareth McCaughan.

See requirements for the input file under the Utility Programs heading. An example text file of the 880 order 4 magic squares is provided. Output .html files are in folder Water<N>[_n]. If the input file is large, output may be split into a number of files. Here is an output example:  WaterRetention3D C code
Displays a 3-dimensional view of water retention. Input order as two numbers for non-square rectangles. The code for the 3D view was written by Claudio Rocchini during the Zimmermann contest. Land is shown in shades of green, water in blue, and the start of spillways between water bodies or out of the square in yellow. For water, the bottom elevations are shown. Here are examples: Output files are in folder Water<N>_3D[_n]. The files are in Scalable Vector Graphics (SVG) format. There is one .svg file for each square in the input file.

You may need to install a viewer like Win 98-XP from Adobe, before your browser will open .svg files. Another way is to download and run a program such as Windows - installer from Inkscape. With Inkscape you can open a .svg file and save it as a .png. WaterRetentionSort C code
Sorts squares in decreasing order of water retention. The number of duplicate squares is reported and duplicates are not output. The output file is <in file name>WRsort[_n].txt. A summary file is also written. WaterRetentionWithComplement C code
For an input file of squares, finds the maximum water retention for a square and its complement. The square(s) and complement(s) having the maximum combined retention are written to a file. For self-complement squares, the square with the maximum retention is written to a file. A summary is written to the console and a file. The output files are in folder WRwithComplement<N>[_n].