For the number n divisible by 4, we can construct magic square as follows:

1. From left to right, from the first line to the nth line, in the order of 1, 2 And n ^ 2 fills this matrix.

2. Divide the above matrix into m ^ 2 small 4×4 matrices. For the number a on the two diagonals of each 4×4 small matrix, replace a with the complement of a, the square of N + 1-A.

That is: A & lt; – n ^ 2 + A-1

### Read More:

- Lingerror last 2 dimensions of the array must be square
- How to use Latex to Write Matrices
- Empty Matrices, Scalars, and Vectors
- The sparse matrix of R language is too large to be used as.matrix
- 【R】【unimplemented type ‘list’ in ‘orderVector1’】
- Python — magic identify file types
- The problem that the normal of the model is no longer perpendicular to the surface after unequal scaling
- Pychar error: Error:failed to find libmagic. Check your installation
- R load(xxx.Rdata) Error bad restore file magic number (file may be corrupted) — no data loaded
- The errors dimensions of materials being qualified are not persistent
- Derivation process of gradient descent method based on house price
- Description of classifier index in Weka
- The image operation of MATLAB — every detail operation of colorbar
- matlab Error Subscript indices must either be real positive integers or logicals.
- [leetcode] zigzag transformation
- Hash conflict and four solutions
- Analysis of R language error replacement has length zero problem
- Forsage fossage system development (build case)
- Wechat applet animate animation does not implement animation effect for the first time
- Develop a Boolean equation for overflow detection