login
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
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.]
From Robert Israel, Oct 27 2015: (Start)
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)
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:
seq(f(i), i=1..30); # Robert Israel, Oct 27 2015
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}]];
Table[a[n], {n, 1, 20}] (* Jean-François Alcover, May 17 2023, after Robert Israel *)
PROG
(MATLAB) det(magic(n));
CROSSREFS
Sequence in context: A016101 A249847 A185255 * A301310 A247335 A112694
KEYWORD
sign
AUTHOR
Magnus Bjerkeng (bjerkeng(AT)stud.ntnu.no), May 17 2009
EXTENSIONS
Edited by N. J. A. Sloane, May 17 2009
Further edits by Robert Israel and N. J. A. Sloane, Oct 27 2015
STATUS
approved