Navigation

Operators and Keywords

Function List:

C++ API

Function File: magic (n)

Create an n-by-n magic square.

A magic square is an arrangement of the integers 1:n^2 such that the row sums, column sums, and diagonal sums are all equal to the same value.

Note: n must be greater than 2 for the magic square to exist.

Package: octave