Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working

MAGIC matrix function

MAGIC(n) creates a n × n matrix with as elements the integers 1 through n2, with equal row and column sums.

The argument n must be larger than 2.

If n=1 then the function returns the scalar {1}; if n=2 then a non-magic square matrix is returned.

Calculator

MAGIC {16,2,3,13|5,11,10,8|9,7,6,12|4,14,15,1}

See also