Sunday Times Teaser 3294 – Four by Four
by Howard Williams
Published Sunday November 09 2025 (link)
With the school inspector scheduled to visit her school, Tina is taking extra care in preparing her lesson plan. The lesson deals with areas, shapes and symmetries. She has produced soft cards on which have been printed a four by four grid, and will ask the pupils to cut the grid into two shapes of equal area, but by only cutting along the lines. She wanted them to create as many different possible shapes in this way, explaining that two shapes are different only if you can’t make one the same as the other by rotating it, turning it over, or both. It turned out that the maximum number of different shapes was the same as the number of pupils in the class.
How many pupils are there in the class?
With some changes and speedups suggested by Frits.
Nice output.
Using ideas from Brian’s code and my initial incorrect version. This was done on my phone so there will be lapses in style. It can be speeded up but I will leave it for now.
Manual analysis shows that the most spread out or extensive shape possible is:
This and all other shapes can be made without using the three leftmost squares on the bottom row. So these squares can be removed from consideration. We can rewrite line 47 accordingly:
Execution time is divided by 8. The same principle can applied to line 66 of Brian’s code
Here is a faster more concise version with inspiration from Brian’s code: there are exactly 7 shape transformations plus the original shape; use of the min or max function to select one of the shapes.