Problem 1673. Pandiagonal Prime Magic Square Verification
Verify if an NxN matrix is a Pandiagonal Prime Magic Square.
Required properties:
1) N^2 prime values ( No repeats, 1 is a non-prime ) 2) Every row, column, diagonal, anti-diagonal, broken diagonals sum to same value 3) Magic Constant is the sum of a row/column/diagonal
Input: M (Matrix NxN)
Output: Magic Constant ( 0 if invalid )
Example:
m=[7 107 23 103;89 37 73 41;97 17 113 13;47 79 31 83]; Magic is 240
Rows;Columns; Diags 7+37+113+83, 107+73+13+47, 23+41+97+79, 103+89+17+31;
Anti-Diag 103+73+17+47, 23+37+97+83, 107+89+13+31, 7+41+113+79
Related:
1) Kurchan Evaluation has similar array processing
2) Create Minimum Pandiagonal Prime Magic Squares (6:20) Bonus for 14
Solution Stats
Solution Comments
Show commentsGroup

Magic Numbers III
- 15 Problems
- 10 Finishers
- Champernowne Constant
- Pandiagonal Prime Magic Square Verification
- Make a Pandiagonal Prime Magic Square: 11 x 11
- Fangs of a vampire number
- Find all vampire fangs
- is the number happy?
- Pandigital number n°1 (Inspired by Project Euler 32)
- Pandigital number n°2 (Inspired by Project Euler 32)
- Pandigital number n°3 (Inspired by Project Euler 32)
- Pandigital Factors (Based on Euler 491)
- Dudeney Numbers: Numbers which are the cube of their decimal sum
- Factorions: Numbers that equal the sum of the factorials of their digits
- Optimum Egyptian Fractions
- Prime Ladders
- Leftovers? Again?!
Problem Recent Solvers35
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!