|
|
A160523
|
|
a(n) is the determinant of the matrix returned by the MATLAB command magic(n).
|
|
1
|
|
|
1, -10, -360, 0, 5070000, 0, -348052801600, 0, 75035738059027200, 0, -41037749689303977660600, 0, 46138065481819513248350194800, 0, -95867954490405704140800000000000000, 0, 343347181141827635973213833586893432832000, 0, -1962493419491568854064862681564905921231239717640, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
The MATLAB command is only supposed to be used when n >= 3. For n=2 it returns a non-magic square (none exist) with determinant -10.
[The MATLAB help page says: M = magic(n) returns an n-by-n matrix constructed from the integers 1 through n^2 with equal row and column sums. The order n must be a scalar greater than or equal to 3.]
For n >= 3, a(n) = 0 if and only if n is even.
a(n) is divisible by n^(n-2), because for odd n, magic(n) is the sum of an integer matrix of rank 2 and a matrix with entries divisible by n.
It appears that a(n) is divisible by n^(n-1). (End)
|
|
LINKS
|
|
|
EXAMPLE
|
n=3: magic(3) = [8 1 6 / 3 5 7 / 4 9 2 ], det(magic(3)) = 8*(5*2-7*9) - 1*(3*2-4*7) + 6*(3*9-4*5) = -360.
|
|
MAPLE
|
f:= proc(n)
if n::even then if n = 2 then return(-10) else return(0) fi fi;
LinearAlgebra:-Determinant(Matrix(n, n, (i, j) -> n*(i + (j - (n+3)/2) mod n) + (i + (2*j-2) mod n) + 1))
end proc:
|
|
MATHEMATICA
|
a[n_] := Which[n == 2, -10, EvenQ[n], 0, True, Det@Table[ n*Mod[i + (j - (n+3)/2), n] + Mod[i + (2j-2), n] + 1, {i, n}, {j, n}]];
|
|
PROG
|
(MATLAB) det(magic(n));
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign
|
|
AUTHOR
|
Magnus Bjerkeng (bjerkeng(AT)stud.ntnu.no), May 17 2009
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|