## Brain-Teaser 479

**From The Sunday Times, 2nd August 1970** [link]

My nephew Anselm collects good old-fashioned sixpences in a good old-fashioned piggy bank. These he recently extracted to audit and, while experimenting by butting them into two or more equal piles of two or more coins, found that there were exactly six different ways in which this could be done.

From one of these combinations he returned one pile to the bank, and found that the balance could again be distributed into equal piles in exactly six different ways. On this second occasion he returned two equal piles from one of the combinations to the bank, and again found that the balance could be distributed into equal piles in six different ways only. He conducted this experiment a total of seven times, on the third occasion returning three piles, on the fourth four piles and so on, and after the seventh found that he had 24 sixpences remaining.

On none of these occasions did he deposit as much as 25s. in the bank. His third deposit was twice as much as his sixth, and three times as much as his second. His fifth deposit was five times as large as his first.

How many sixpences had he saved up?

I have modified the wording slightly to clarify the puzzle.

[teaser479]

## Jim Randell 12:59 pm

on7 May 2019 Permalink |I assumed that making one pile with all the coins in does not count (as there are no solutions if it does count as one of the six configurations).

1s = 12d, so at no point does Anselm deposit more than 52 coins. So he cannot start with more than (24 + 7×52 = 388) coins. This gives us a bounded solution space to search in, but it is more interesting to run the process backwards starting with the 24 final coins.

This Python 3 program works backwards recursively to solve the problem. It runs in 79ms.

Run:[ @repl.it ]Solution:Anselm has 138 sixpences.LikeLiked by 1 person