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.

For diagonal elements all = d and all other elements = 1,

for n greater than or equal 3:

for n odd:

det(Mn) = d^n - n d + (n-1)

for n even:

det(Mn) = d^n - (n/2) d^2 + (n/2 -1)

(this is a start)