A magic square is loosely defined as a square divided into smaller squares each containing a number, such that the numbers in each columns, in each rows, and in the diagonal add up to the same value. For this problem, the numbers which will be filling the squares are primes. There is no unique answer to the problem; therefore, your answers will be tested against the requirement.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers11
Suggested Problems
-
Project Euler: Problem 1, Multiples of 3 and 5
3670 Solvers
-
Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
903 Solvers
-
327 Solvers
-
Find the Oldest Person in a Room
20290 Solvers
-
Calculate the average value of the elements in the array
1733 Solvers
More from this Author180
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Is there an algorithm for this?
@Ramon yes; for instance, you could consider all (n^2)-tuples of distinct primes in order of their sum until you find one that happens to yield a magic square. Practical algorithms, on the the hand --- I'm not aware of any.