Problem 2650. Kurchan 4x4 - Optimal score
Related to Problem 1646, but bigger. Technically, all you need to do for this Cody problem is input a 4x4 matrix containing the numbers 1-16. 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(4) is
16 2 3 13 5 11 10 8 9 7 6 12 4 14 15 1
The row products are:
- 16*2*3*13=1248
- 5*11*10*8=4400
- 9*7*6*12=4536
- 4*14*15*1=840
The column products are:
- 16*9*5*4=2880
- 2*11*7*14=2156
- 3*10*6*15=2700
- 13*8*12*1=1248
The diagonal products are:
- 16*11*6*1=1056
- 2*10*12*4=960
- 3*8*9*14=3024
- 13*5*7*15=6825
The anti-diagonal products are:
- 13*10*7*4=3640
- 3*11*9*1=297
- 2*5*12*15=1800
- 16*8*6*14=10752
The highest value is 10752, while the lowest is 297. Therefore, the score of this matrix is 10455. Your Cody score will be the Kurchan score of your matrix.
Solution Stats
Problem Comments
-
2 Comments
And do we seek to obtain a higher or lower score? what is the goal?
I went for the minimum score that I was able to find at least, and
found 3724. Moreover, I submitted the algorithm and the hardcoded solution.
Solution Comments
Show commentsProblem Recent Solvers35
Suggested Problems
-
3834 Solvers
-
Extract leading non-zero digit
2134 Solvers
-
14011 Solvers
-
282 Solvers
-
Natural numbers in string form
1424 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!