Skip to content

Sunday Times Teaser 3179 – Sums and Products

by BRG on August 25, 2023

by Andrew Skidmore

Published Sunday August 27 2023 (link)

Mrs Green uses a dice game to improve the maths skills of her pupils. The children sit four to a table and each child throws five dice. Points are awarded according to the sum and product for each child; bonus points are awarded if the five scores contain three or more of the same number.

At Liam’s table all four children had the same sum but all achieved that sum in different ways. Surprisingly, all of the twenty dice scored more than one and no bonus points were awarded. The distribution of scores was: sixes…5; fives…4; fours…2; threes…4; twos…5. Liam had the highest product.

What, in ascending order, were Liam’s five scores?

From → Uncategorized

5 Comments Leave one →
  1. BRG permalink

  2. Frits permalink

    No recursion this time.

    • BRG permalink

      Hi Frits,

      It is quite fast but a lot faster in relative terms with combinations_with_replacement() in place of product().

      Brian

    • Frits permalink

      You are right. As I got a time under 10ms I didn’t really bother about this.
      Following is a small benchmark.

      combinations_with_replacement() has probably been written in C.

      • BRG permalink

        My impression in looking at a lot of code is that “combinations with
        replacement” is under appreciated!

Leave a Reply

Note: HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS