The software on this site may be used freely.

You should use only if you agree to the
freeware disclaimer.

There are
Windows,
macOS, and
Linux
apps with source code files for the programs described below.

The **Win c++** code is from **Microsoft Visual Studio** used to build the
executables for Windows.

The **GNU c++** code was compiled with **g++** for the **macOS** and **Linux** executables.

The **Linux** executables were supplied by
**Holger Danielsson**,
holger@danielsson.info

who has a website at
https://www.magic-squares.info/en.html.

To download and run a Windows app see
Win download.

To download and run a Mac app see
Mac download.

To download and run a Linux app see
Linux download.

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

AdjacentCornerSquares | Win c++ | GNU c++ |
---|

AdjacentSideSquares | Win c++ | GNU c++ |
---|

AssociativeSquares | Win c++ | GNU c++ |
---|

BlockSquares | Win c++ | GNU c++ |
---|

BorderedSquare | Win c++ | GNU c++ |
---|

BorderedSquare1 | Win c++ | GNU c++ |
---|

BorderedSquares | Win c++ | GNU c++ |
---|

- 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

Squares are sorted in ascending order in
Frénicle standard form, with duplicates removed.

Output files are in folder BorderedSquares[_n].

BorderedRectangles | Win c++ | GNU c++ |
---|

DoubleBorderedRectangles | Win c++ | GNU c++ |
---|

NestedCornerRectangles | Win c++ | GNU c++ |
---|

For square rectangles, it is quite slow even at orders as small as 17. In program BorderedRectangles above, both main diagonals are naturally correct from placement of the complementary pairs. Here, this is true for only one of the diagonals. The search for a combination that makes the other diagonal correct can take a long time.

This is not a problem for non-square rectangles.

BorderingSquares | Win c++ | GNU c++ |
---|

CompositeSquares | Win c++ | GNU c++ |
---|

CompositeCalligraphy | Win c++ | GNU c++ |
---|

Example:

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.

FranklinMagicSquares | Win c++ | GNU c++ |
---|

MagicRectangles | Win c++ | GNU c++ |
---|

Most-perfectSquares | Win c++ | GNU c++ |
---|

PandiagonalSquares | Win c++ | GNU c++ |
---|

ReversibleSquares | Win c++ | GNU c++ |
---|

SelfComplementSquares | Win c++ | GNU c++ |
---|

To make associative self-complement magic squares, use program AssociativeSquares

LatinSquares | Win c++ | GNU c++ |
---|

LatinSquaresLT | Win c++ | GNU c++ |
---|

NFR_NBD | Win c++ | GNU c++ |
---|

GetDiagonals | Win c++ | GNU c++ |
---|

GetOrthogonal | Win c++ | GNU c++ |
---|

- 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++ | GNU c++ |
---|

GetTransversals | Win c++ | GNU c++ |
---|

- all: all transversals
- diagonal: transversals having exactly one element from each main diagonal

GetTransversals64 | Win c++ | GNU c++ |
---|

DLScanonizer | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

SODLS | Win c++ | GNU c++ |
---|

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:

- SODLS
- magic square
- SODLS and magic square

SODLSs | Win c++ | GNU c++ |
---|

SODLS9 | Win c++ | GNU c++ |
---|

SODLS10 | Win c++ | GNU c++ |
---|

SymlateralSquares | Win c++ | GNU c++ |
---|

Zigzag_{2}Squares
| Win c++ | GNU c++ |
---|

For power of 2 orders, (8,16,32,...), optionally makes pandiagonal, complete, compact

Output files are in folder ZigZag2[_n].

Order5 | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

Order5TopGroups | Win c++ | GNU c++ |
---|

Order5Count | Time: 3.7 minutes | Win c++ | GNU c++ |
---|

Order6C | Win c++ | GNU c++ |
---|

- 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 | Win c++ | GNU c++ |
---|

Order6Ccount | Time: 1.8 minutes | Win c++ | GNU c++ |
---|

Order7Ccount | Time: 1 h 55 m | Win c++ | GNU c++ |
---|

Order7BentDiagonal | Time: 2 h 12 m | Win c++ | GNU c++ |
---|

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.

Franklin8 | Win c++ | GNU c++ |
---|

Most-perfect8 | Win c++ | GNU c++ |
---|

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 Linux or 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++ | GNU c++ |
---|

CompleteSquare | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

CopySquaresByNumber | Win c++ | GNU c++ |
---|

Non-square rectangles are also supported, (input order as two numbers, rows columns, for example: 4 6 ).

CopySquaresByPondCount | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

Non-square rectangles are also supported, (input order as two numbers, rows columns, for example: 5 7 ). See examples.

Frenicle | Win c++ | GNU c++ |
---|

Frenicle64 | Win c++ | GNU c++ |
---|

GetDuplicates | Win c++ | GNU c++ |
---|

GetMagic | Win c++ | GNU c++ |
---|

GetQR | Win c++ | GNU c++ |
---|

GetType | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

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

HighlightSquare | Win c++ | GNU c++ |
---|

- non-prime numbers
- prime numbers
- odd numbers
- even numbers
- singly-even numbers
- doubly-even numbers
- numbers in the natural position
- prime numbers in the natural position
- number range

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 ).

Also, for "Number range, (low high)" and "Cell pixels, (width height)" input two numbers folllowed by .

Output .html files are in folder highLight[_n].

This feature is an idea of Craig Knecht.

HighlightSort | Win c++ | GNU c++ |
---|

Hurkens | Win c++ | GNU c++ |
---|

Rotate | Win c++ | GNU c++ |
---|

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

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

SquareSort | Win c++ | GNU c++ |
---|

SquareSort64 | Win c++ | GNU c++ |
---|

SquareSums | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

Hint: Also useful to format a badly formatted rectangles file.

Transforms1_2 | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

Complement | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

Most-perfectToFranklin | Win c++ | GNU c++ |
---|

ReversibleMost-perfect | Win c++ | GNU c++ |
---|

ReversibleToAssociative | Win c++ | GNU c++ |
---|

ReversibleToFranklin | Win c++ | GNU c++ |
---|

WaterRetention | Win c++ | GNU c++ |
---|

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++ | GNU c++ |
---|

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++ | GNU c++ |
---|

WaterRetentionWithComplement | Win c++ | GNU c++ |
---|