Related to Problems 1646 and 2650, but bigger. Technically, all you need to do for this Cody problem is input a 5x5 matrix containing the numbers 1-25. However, your score will be the Kurchan value of the matrix, which is defined as the difference between the maximum and minimum of the products for the rows, columns, diagonals, and anti-diagonals of the matrix.
For example: Magic(5) is
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
The row products are:
- 17 * 24 * 1 * 8 * 15=48960
- 23 * 5 * 7 * 14 * 16=180320
- 4 * 6 * 13 * 20 * 22=137280
- 10 * 12 * 19 * 21 * 3=143640
- 11 * 18 * 25 * 2 * 9=89100
The column products are:
- 17 * 23 * 4 * 10 * 11=172040
- 24 * 5 * 6 * 12 * 18=155520
- 1 * 7 * 13 * 19 * 25=43225
- 8 * 14 * 20 * 21 * 2=94080
- 15 * 16 * 22 * 3 * 9=142560
The diagonal products are:
- 17*5*13*21*9=208845
- 24*7*20*3*11=110880
- 1*14*22*10*18=55440
- 8*16*4*12*25=153600
- 15*23*6*19*2=78660
The anti-diagonal products are:
- 15*14*13*12*11=360360
- 8*7*6*10*9=30240
- 1*5*4*3*2=120
- 24*23*22*21*25=6375600
- 17*16*20*19*18=1860480
The highest value is 6375600, while the lowest is 120. Therefore, the score of this matrix is 6375480. Your Cody score will be the Kurchan score of your matrix.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers42
Suggested Problems
-
Test if a Number is a Palindrome without using any String Operations
251 Solvers
-
Project Euler: Problem 3, Largest prime factor
1785 Solvers
-
find the maximum element of the matrix
535 Solvers
-
607 Solvers
-
Find out sum and carry of Binary adder
1692 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I went for the minimum score that I was able to find at least, and
found 102810. Moreover, I submitted the algorithm and the hardcoded solution.
Shame that feval doesn't work anymore
why showing error?