Downloads

Freeware Disclaimer

The software on this site may be used freely.
You should use only if you agree to the freeware disclaimer.

There are source code files and Win32 applications for the programs described below.
Source code files and Mac 64-bit programs are being added.

To download and run a program on Windows see Win download.
To download and run a program on Mac see Mac download.

Note: Run times are for a 3.0 GHz Windows PC.

Adjacent

AdjacentCornerSquares Win C++ Mac C++
Makes adjacent corner pair magic squares. Squares are sorted in ascending order in Frénicle standard form, with duplicates removed. Output files are in folder AdjacentCornerSquares[_n].

AdjacentSideSquares Win C++ Mac C++
Makes adjacent side pair magic squares. Squares are sorted in ascending order in Frénicle standard form, with duplicates removed. Output files are in folder AdjacentSideSquares[_n].

Associative

AssociativeSquares Win C++ Mac C++
Makes associative magic squares. For singly-even order the squares are near-associative. Squares are sorted in ascending order in Frénicle standard form, with duplicates removed. Output files are in folder AssociativeSquares[_n].

Block

BlockSquares Win C++ Mac C++
Makes block magic squares. Prime order squares are made with 1 or 2 borders. Some even order squares are also made with borders or bordered blocks. Output .txt and .html files are in folder BlockSquares[_n].

Bordered

BorderedSquare Win C++ Mac C++
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 Win C++ Mac C++
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 Win C++ Mac C++
Makes bordered magic squares. Makes many distinct squares by randomly:

Squares are sorted in ascending order in Frénicle standard form, with duplicates removed.
Output files are in folder BorderedSquares[_n].

BorderedRectangles Win C++ Mac C++
Makes bordered magic rectangles including squares. Output files are in folder BorderedRectangles[_n]. For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ).

Bordering

BorderingSquares Win C++ Mac C++
Makes bordering magic squares. Output files are in folder BorderingSquares[_n].

Composite

CompositeSquares Win C++
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 Win C++
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 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 Win C++ Mac C++
Makes Franklin magic squares. Output files are in folder FranklinNormalMagicSquares[_n].

Magic

MagicRectangles Win C++ Mac C++
This program makes magic rectangles. The type can be specified as semimagic, magic, associative, concentric, or pandiagonal. Pandiagonal succeeds only for small orders. For non-square rectangles, (input order as two numbers, rows columns, for example: 5 7 ). See also CompleteSquare. Output files are in folder MagicRectangles[_n].

Most-perfect

Most-perfectSquares Win C++ Mac C++
Makes most-perfect magic squares. Output files are in folder Most-perfectSquares[_n].

Pandiagonal

PandiagonalSquares Win C++ Mac C++
Makes pandiagonal magic squares. For singly-even order the squares are near-pandiagonal. Squares are sorted in ascending order in Frénicle standard form, with duplicates removed. Output files are in folder PandiagonalSquares[_n].

Reversible

ReversibleSquares Win C++ Mac C++
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 Win C++ Mac C++
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 Win C++ Mac C++
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 Win C++ Mac C++
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.

GetQR Win C++
Gets the quotient and remainder squares of magic squares. The output file is <in file name>QR[_n].txt.

NFR_NBD Win C++
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

GetDiagonals Win C++
Gets the \ or / diagonals from squares and sorts them in ascending order removing duplicates. The output file is <in file name>-[1|2]Diags[_n].txt

GetOrthogonal Win C++
Finds orthogonal pairs in a file of Latin squares. There are two formats:
1:
Get the counts of orthogonal pairs for each square and output these and a list of mates.
For the first square with the maximum number of pairs, output it and its mates. Files:
<in file name>-orthCounts[_n].txt
<in file name>-orthNos[_n].txt
<in file name>-<square number>orths[_n].txt.
2:
Prompt for input of a square number to output with its mates. File:
<in file name>-<square number>orths[_n].txt.

GetOrthogonal64 Win C++
A 64 bit version of GetOrthogonal.

GetTransversals Win C++
Counts the transversals of Latin squares. Count types are: The maximum transversals is printed with the square number. Counts are in file <N>Transversals[_n].

GetTransversals64 Win C++
A 64 bit version of GetTransversals.

DLScanonizer Win C++
Makes canonical forms of diagonal Latin squares of orders 4 to 15.
There are two formats: natural order first row, (nfr), or natural order \diagonal, (nbd).
Output files are output<N>CF1[_n] or output<N>CF2[_n].

DLScanonizer64 Win C++
A 64 bit version of DLScanonizer.

SODLS

SODLS Win C++ Mac C++
Makes self-orthogonal diagonal Latin squares and their magic squares for all valid orders, (i.e., not 2, 3, or 6).
Makes a minimum of 1 kind of SODLS for any order, many kinds for some orders. See descriptions in SODLS.
The kind is randomly chosen, (with bias in favor of some kinds), so it may be necessary
to enter an order many times to get a SODLS of each kind. See also SODLS Construction Methods.

Input is an order, (one number), or an order range, (two numbers).
Output files are in folder SODLS[_n]. Each file optionally contains:

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

SODLS9 Win C++
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 Win C++
Makes order 10 SODLS. Output files are SODLS10[_n]. See notes. Uses techniques given in the 2017 paper by Kochemazov, Vatutin, Zaikin.

Symlateral

SymlateralSquares Win C++ Mac C++
Makes symlateral magic squares. Output files are in folder SymlateralSquares[_n].

Zigzag2

Zigzag2Squares Win C++ Mac C++
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 Win C++ Mac C++
Makes the 880 order 4 magic squares. Output is a .txt file.

Order 5

Order5 Win C++ Mac C++
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 Win C++ Mac C++
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 Win C++ Mac C++
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].

Order5CountTime: 3.7 minutes Win C++ Mac C++
Computes the number of order 5 magic squares. Only the source code is provided.

Order 6 Concentric

Order6C Win C++
Makes 4x4 center squares and border groups. For an input range of partitions, the output is:

See Order6CDoc.txt and Order6CExamples.txt. Output files are in folder Order6C[_n].

Order6CSample Win C++
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.

Order6CcountTime: 1.8 minutes Win C++
Computes the number of order 6 concentric magic squares, (736,347,893,760). Only the source code is provided.

Order 7

Order7Ccount Time: 1 h 55 m Win C++
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 Win C++
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.
These squares were first made by a FormulaOne Compiler program.

Order 8

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

Most-perfect8 Win C++ Mac C++
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 plain text file containing one or more number squares or rectangles of the same order. The text file must contain only the square or rectangle numbers separated by white space characters, (blank, horizontal tab, newline).

You will be prompted first to input the order of the squares or rectangles, 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, on Windows, if you run program Frenicle in folder C:/Users/yourname/programs
and file order4squares.txt is in the same folder, for file name enter:

    order4squares

If the file is in say C:/Users/yourname/squares, for file name enter one of:

    C:/Users/yourname/squares/order4squares

    ../squares/order4squares

Similarly, on Mac if program Frenicle is in folder /Users/yourname/programs,
run Terminal and enter:

    cd /Users/yourname/programs
    ./Frenicle

If file order4squares.txt or order4squares is in the same folder, for file name enter:

    order4squares

If the file is in say /Users/yourname/squares, for file name enter one of:

    /Users/yourname/squares/order4squares

    ../squares/order4squares

Bones Win C++ Mac C++
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. Non-square rectangles are also supported, (input order as two numbers, rows columns, for example: 4 6 ). Output .html file(s) are in folder ToFromBones<RxC>[_n]. If the input file is large, output may be split into a number of files.

CompleteSquare Win C++ Mac C++
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, rows columns, for example: 4 6 ). 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 Win C++ Mac C++
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 Win C++ Mac C++
Copies squares from a file. Squares to copy are chosen by a number or number range. Enter a number range as two numbers, (for example: 50 100 ). The output file is Order<N>Copy<num>[_n].txt or Order<N>Copy<num1>to<num2>[_n].txt
Non-square rectangles are also supported, (input order as two numbers, rows columns, for example: 4 6 ).

CopySquaresByPondCount Win C++
For a file of magic rectangles, outputs a count of rectangles with each number of ponds. Copies rectangles containing a specified number of ponds. See water retention. For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ). For this program, a pond is any group of contiguous wet cells.
The output file is <in file name>-<num ponds>pond(s)[_n].txt.
Hint: To output no rectangles, specify a negative number.

CopySquaresByType Win C++ Mac C++
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.
Non-square rectangles are also supported, (input order as two numbers, rows columns, for example: 5 7 ). See examples.

Frenicle Win C++ Mac C++
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 Win C++ Mac C++
For Windows, 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.

GetDuplicates Win C++
Reports duplicate numbers in rectangles. Supports number range 0 to RxC, for order R by C rectangles. For non-square rectangles, input order as two numbers, rows columns, (for example, 5 7 ).

GetMagic Win C++
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 Win C++ Mac C++
Checks the type of each square as: not magic, normal semimagic, other semimagic, normal magic, other magic.

Checks all square types for associative, pandiagonal, self-complement, axial, symmetric, and transpose parity. If the type is normal magic, checks other properties : adjacent corner, adjacent side, odd-associative, even-associative, concentric, bordered, bordering, symlateral, ultramagic, complete, compact, bent diagonal, Franklin, zigzag, bimagic, trimagic. If the type is normal semimagic also checks appropriate properties in the list.

If the type is other magic, checks for prime number square and properties ultramagic, complete, compact, concentric, bimagic.

If the type is not magic, checks for reversible, pandiagonal.

Also supports non-square rectangles, (input order as two numbers, rows columns, (for example, 5 7 )).

Also supports Latin square and diagonal Latin square types and properties:
cyclic pandiagonal, semi-cyclic pandiagonal, weakly pandiagonal, ultramagic, axial symmetric, double axial symmetric, center symmetric, orthogonal, self-orthogonal, doubly 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 Win C++ Mac C++

Same as GetType with summary results written to the console only.

HighlightSquare Win C++
Displays number rectangles with featured cells highlighted in color. Optionally, groups of connected cells are colored differently by group size. Highlighted feature choices are: Natural position advances right, then down, starting from 1 at upper left.
For associative rectangles, with the number range feature, groups of complementary numbers are assigned the same color as their counterpart groups.
For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ). Output .html files are in folder highLight[_n].

This feature is an idea of Craig Knecht.

HighlightSort Win C++
Sorts rectangles in descending or ascending order of the number of highlighted groups. See HighlightSquare. The number of duplicate rectangles is reported and duplicates are not output. For non-square rectangles, input order as two numbers, rows columns, (for example, 5 7 ). The output file is <in file name>-<highlight name>Sort<D|A>[_n].txt. A summary file is also written.

Hurkens Win C++
Puts Franklin squares in Hurkens principal form. The output file is <in file name>Hurkens[_n].txt

Rotate Win C++ Mac C++
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 Win C++ Mac C++
Sorts rectangles in ascending or descending numerical sequence order removing duplicates. For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ). Rectangle aspect is not changed, so duplicates with different aspect are not removed. Compare Frenicle. The output file is <in file name>Sorted<A|D>[_n].txt

SquareSort64 Win C++ Mac C++
For Windows, a 64 bit version of SquareSort that can sort much bigger files if enough RAM is available.

SquareSums Win C++
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.
Optionally sums 1: numbers, 2: numbers squared, or 3: numbers cubed.

Also supports non-square rectangles for rows, columns, and pan diagonals, (input order as two numbers, rows columns, (for example, 5 7 )).

The output file is <in file name>_<|Sq|Cu>Sums[_n].txt

ZeroOne Win C++ Mac C++
Converts rectangles from range 0 .. to 1 .. or vice versa. The range to convert to is indicated by input of 0 or 1. Rectangles that are already in the selected range are copied unchanged. Rectangles with smallest value not equal to 0 or 1 are copied unchanged. For non-square rectangles, input order as two numbers, rows columns, (for example, 5 7 ). The output file is <in file name>To<0|1>[_n].txt
Hint: Also useful to format a badly formatted rectangles file.

Transform

Transforms1_2 Win C++
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 Win C++
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 Win C++
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.
Also supports non-square rectangles, (input order as two numbers, rows columns, (for example, 4 6 ).

AssocPan Win C++
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 Win C++
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 Win C++
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. Optionally, unique squares are made. See notes. With this option, the most-perfect square is in Frénicle standard form and the reversible square aspect is also outout.

ReversibleToAssociative Win C++
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 Win C++
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 Win C++
Computes and displays the water retention patterns of number rectangles. For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ). 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:

There is an option to color the water areas by size in the Units square:

WaterRetention3D Win C++
Displays a 3-dimensional view of water retention. For non-square rectangles, input order as two numbers, rows columns, (for example, 5 7 ). 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 Win C++
Sorts rectangles in decreasing or increasing order of water retention. For non-square rectangles, input order as two numbers, rows columns, (for example, 4 6 ). The number of duplicate rectangles is reported and duplicates are not output. The output file is <in file name>WRsort[_n].txt. A summary file is also written.

WaterRetentionWithComplement Win C++
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].