hpc.social


High Performance Computing
Practitioners
and friends /#hpc
Share: 
This is a crosspost from   Cleve’s Corner: Cleve Moler on Mathematics and Computing Cleve Moler is the author of the first MATLAB, one of the founders of MathWorks, and is currently Chief Mathematician at the company. He writes here about MATLAB, scientific computing and interesting mathematics.. See the original post here.

Revolving Century Puzzle and Magic Squares

The Revolving Century puzzle is a beautifully made wooden puzzle from Creative Crafthouse in Hudson, Florida.

The sum of the numbers on each of the six rotating puzzle pieces is 100. The goal is to rotate the pieces so that the sum for each of the six columns is also 100. It is like a circular 6-by-6 magic square.

Contents

Digital Version

Our digital version of the Revolving Century puzzle uses 36 polyshapes like this one.

The pieces are numbered with the integers from zero to 35, except the piece numbered 30 has been replaced by a second zero. This gives the desired "century" sum.

   v = 0:35;
   v(v==30) = 0;
   c = sum(v)/6
   c =
      100

State

The state of the puzzle is described by a 6-by-6 matrix.

 
   A = start
   A =
        1     4    25    29     6    35
       18     5    34    33     0    10
       19    24     2    26     8    21
       28    13    32     0    11    16
       12    14    23     7    27    17
       15    20    22    31     3     9

The row sums are all equal, but the column sums are not.

   rows = sum(A')
   cols = sum(A)
   rows =
      100   100   100   100   100   100
   cols =
       93    80   138   126    55   108

Move

A puzzle move rotates one row of the state matrix, for example, the third row.

   shift = [2:6 1];
   r = 3;
   A
   A(r,:) = A(r,shift)
   A =
        1     4    25    29     6    35
       18     5    34    33     0    10
       19    24     2    26     8    21
       28    13    32     0    11    16
       12    14    23     7    27    17
       15    20    22    31     3     9
  A =
        1     4    25    29     6    35
       18     5    34    33     0    10
       24     2    26     8    21    19
       28    13    32     0    11    16
       12    14    23     7    27    17
       15    20    22    31     3     9

Since we have a computer handy, we can also track the column sums.

Search

The only way to find a solution that I know of is an exhaustive search. There are only 6^5 = 7776 possible states. It takes 4787 steps and less than a tenth of a second on my laptop to find the solution.

Here are the last few steps of the exhaustive search for a solution.

Magic

I could have used an actual magic square.

   A = magic(6)
   A =
       35     1     6    26    19    24
        3    32     7    21    23    25
       31     9     2    22    27    20
        8    28    33    17    10    15
       30     5    34    12    14    16
        4    36    29    13    18    11

I would need to change the name of the puzzle to "Revolution 111".

Solution

Here is the solution of the original Revolution Century puzzle.

   A = solution
   A =
       25    29     6    35     1     4
       33     0    10    18     5    34
       21    19    24     2    26     8
       11    16    28    13    32     0
        7    27    17    12    14    23
        3     9    15    20    22    31

I can transfer that to the analog puzzle.

Software

A self-extracting archive for polypuzzle is available here.


Get the MATLAB code

Published with MATLAB® R2024b