### Magic Square: Java applet

The applet below can be used to generate magic squares with odd sides (1, 3, 5 of 7).
After some experiments you will probably discover the construction method, enabling you to
make bigger squares for yourself. Here, a magic square is considered to be a sqare filled
with integer numbers from a monotonic sequence, i.e. a sequence having a constant
difference between consecutive elements, in *such a way* that all sums of rows,
columns and both diagonals are equal.

#### Instructions for using the program

Choose the desired size of the square in the choice list in the upper left corner. If
everything works properly a square of empty text fields appears, with comments on the
sides and some extra text fields for row, column and diagonal totals. Type the horizontal
and vertical *positions* of the *first* number of the abovementioned
monotonic sequence in both text fields below the text 'Coordinaten beginvak:'. Next type
the *values* of this first number and the constant difference to the right of the
texts 'Basis' and 'Increment'. Then, clicking the button 'Maak vierkant' (*make square*),
the desired square is generated. Although... in most cases only a *semi*-magic
square appears. Clicking the button 'Bereken sommen' (*compute sums*), you may
notice that all row and column sums always match, but most likely one or both diagonal
sum(s) (the squares below, extreme left and right) do not. It is up to you to play with
the input data until you find a true magic square! By the way, another possibility of
using the applet is trying to make a magic square from scratch, by typing the numbers into
the text fields yourself, using trial and error. Checking the sums is possible at any time
if you click on 'Bereken sommen'.

Last updated June 1st, 2006

Back to Other professional activities

Back to Professional home page

Back to Joop's home page in English.

Terug naar Joop's home page in het Nederlands