Kurchan 4x4 - Optimal score - MATLAB Cody - MATLAB Central

Problem 2650. Kurchan 4x4 - Optimal score

Difficulty:Rate

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

80.0% Correct | 20.0% Incorrect
Last Solution submitted on May 07, 2025

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers37

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page