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.

(In reply to

re: derivation of the formula by Daniel)

so i use your analysis to check my result that M7 works for 2019.

(Like a politician, if you can't answer the question, make up your own question.)

Was my answer n=7 correct or was it just roundoff error?

det Mn = 2018^(n-1)*(2018+n)

if n-1 is even then 2018+n is square

(I immediately know my answer n=7 works as 2018+7 = 45^2,

but, maybe there is a smaller even n)

anyway - finishing the n-1 even case:

thus 2018+n=k^2 or n=k^2-2018

for n-1 to be even, n is odd which then means k is odd

so for odd k we have n=k^2-2018 as a solution

the smallest integer value for n this gives is when k=45, giving n=7

---

if n-1 is odd then 2018*(2018+n) is square

if 2018(2018+n) is square then 2018 must divide 2018+n

thus if n is even, n is a multiple of 2018 and thus is greater than 7.

So, yes M7 minimizes n for 2019 being a square.

(I feel better now being Wolfram-Alpha-free)

*Edited on ***June 16, 2018, 11:11 pm**