Consider 4 magic circle circles around a single number in the sequence 1:n where the sum along the diameters is always equal, and the sum for each circle is also equal.
If n=33 then return a truth function corresponding to whether the supplied matrix is magic or not. Diameter numbers are written in columns, and the centre number thus appears in each diameter sequence. Rows contain numbers along semi circles.
Example
c = [ 20 33 12 4 ;
16 1 31 21 ;
23 13 19 4 ;
10 22 7 30 ;
9 9 9 9 ;
2 18 25 34 ;
29 26 11 3 ;
32 17 5 15 ;
6 8 28 27 ]; is not magic over 1:n
c = [ 20 33 12 4 ;
16 1 31 21 ;
23 13 19 14 ;
10 22 7 30 ;
9 9 9 9 ;
2 18 25 24 ;
29 26 11 3 ;
32 17 5 15 ;
6 8 28 27 ]; is magic
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers15
Suggested Problems
-
Program an exclusive OR operation with logical operators
751 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
652 Solvers
-
Convert a vector into a number
619 Solvers
-
Implement a bubble sort technique and output the number of swaps required
397 Solvers
-
There are 10 types of people in the world
1379 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
matrix in test case 3 is magical?
sum first circle=73
sum second circle =61....
The test case #5 in is not a magic circle because its radii are not equal (column 3 should be made of two 69s as are all the others, but instead they are 82 and 56). Please fix the test suite whenever possible.