In this assignment the programe will generate ALL magic squares of order 4 through permutation. The
process is straight forward but time consuming. Here are the steps:
- Create a 1-D list of integers 1 through 16.
- Permute this list of integers.
- For each permutation convert the 1-D list into a 2-D list that is 4 x 4.
- Check if that 2-D list is a magic square. If it is, then print it out.
- Stop when you have gone through all the permutations.
The magic constant is given by n * (n2 + 1) / 2, where n is the dimension of the magic square. For a 4 x 4 magic square the constant is 34.
In this program there is no user input. You may reuse any code that you have written for the first assignment. To save space you may print out your magic squares as 1-D list of numbers. Your output will look as follows: