Problem 2652. Kurchan 5x5 - Optimal Score

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

85.0% Correct | 15.0% Incorrect
Last Solution submitted on Oct 19, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers36

Suggested Problems

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!