Verifying a magic square

Question Q6.1.9

Verify that the magic square created in Example E6.2 satisfies the conditions that it contains the numbers 1 to $N^2$ and that its rows, columns and main diagonals sum to $N(N^2+1)/2$.


Solution

To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.