Magic constant of a magic square or hypercube
magic.constant.Rd
Returns the magic constant: that is, the common sum for all rows, columns and (broken) diagonals of a magic square or hypercube
Details
If n
is an integer, interpret this as the order of the square
or hypercube; return \(n({\rm start}+n^d-1)/2\).
If n
is a square or hypercube, return the magic constant for
a normal array (starting at 1) of the same dimensions as n
.