For each positive integer n, let Mn be the square matrix (nxn) where each diagonal entry is 2018, and every other entry is 1.

Determine the smallest positive integer n (if any) for which the value

of det(Mn) is a perfect square.

I ran through the det(M2) to det(M7), this time using the correct formulae for the determinants. :-)

E.g.

det(M7) = x^7 -21 x^5 +70 x^4 -105 x^3 +84 x^2 -35 x + 6

(Thanks Dr. Wolfram)

I didn't get 2018 to work for n<8 but I think maybe 2019 works for M7

I can not be sure that there is not a roundoff error (could someone with this computer ability check?) but perhaps for 2019

det(M7)=369807742440.00000^2

(Or else I was just really unlucky to get 5 zeros.)

But, I am interested to know how to solve this problem more elegantly!

*Edited on ***June 15, 2018, 7:17 pm**

*Edited on ***June 15, 2018, 7:18 pm**