Problem 314. Find the sum of the elements in the "second" diagonal
58.32% Correct | 41.68% Incorrect
Last Solution submitted on May 30, 2023
Show 1 older comment
@bmtran (Bryant Tran) on 12 Feb 2012
you might want to make a case that's not a magic square, considering the properties of the diagonals of a magic square...
Gaik Tamazian on 17 Feb 2012
There are only magic squares in test cases, however the problem doesn't specify a type of the matrix.
David Young on 1 Mar 2012
You should definitely strengthen the test suite. Lots of solutions rely on both diagonals being the same, even though this is not a property of the stated problem.
Kye Taylor on 7 Apr 2012
The "antidiagonal" is cooler sounding than "second diagonal"
Solution CommentsShow comments
Problem Recent Solvers1106
Project Euler: Problem 10, Sum of Primes
Sum of diagonal of a square matrix
Make a random, non-repeating vector.
More from this Author1
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!