### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,158)
- misc (2)
- project euler (2)
- puzzle (40)
- site news (44)
- tantalizer (42)
- teaser (3)

### Site Stats

- 177,972 hits

Advertisements

Programming Enigma Puzzles

8 March 2017

Posted by on **From New Scientist #1039, 17th February 1977** [link]

The Smiths have ten children and a dog called Marmaduke. Every so often they buy a huge tin of toffees and them out after tea, one at a time starting with the oldest child. They never miss a child out but whether Marmaduke gets a toffee at every, some or any turn depends on the whim of the moment. Mr and Mrs Smith never take any toffee for themselves.

Now look at it from Marmaduke’s point of view. He never gets one of the first ten toffees. He may or may not get the 11th. He certainly won’t get the 12th, 13th, 14th etc, but he becomes eligible for one at the end of the round, exactly when depending on whether he was lucky or not on the first round.

Now go back to the start of the process with a fresh tin about to be broached. Which is the highest numbered toffee which Marmaduke will certainly not get?

[tantalizer488]

Advertisements

%d bloggers like this:

This Python program runs in 39ms.

Solution:The highest numbered toffee that we can say for certain Marmaduke willnotget is toffee 100.Analytically:

If we consider a sequence of “rounds”, where each child gets a sweet, and then possibly the dog does too.

In round 1 the dog is definitely not going to get toffees 1 – 10, as they all go to the children. But he may get toffee 11.

In round 2:

If the dog did not get toffee 11, then the children get 11 – 20, and the dog may get toffee 21.

If the dog did get toffee 11, then the children get 12 – 21, and the dog may get toffee 22.

So whatever happens he can never get toffees 12 – 20, but may get 21 or 22.

In round 3:

If the dog has had no toffees so far, then the children get 21 – 30 (and the dog may get 31).

If the dog has had 1 toffee so far, then the children get 22 – 31 (and the dog may get 32).

If the dog has had 2 toffees so far, then the children get 23 – 32 (and the dog may get 33).

So the dog cannot get 23 – 30, but may get 31, 32, 33.

And so we continue as summarised in the diagram below:

(X represents a toffee that the dog definitely won’t get, ? represents a toffee that the dog may get).

When we get to the 10th round, the dog cannot get toffee 100, but may get any of 101 – 110.

And in the 11th round there are no toffees that we can say for certain the dog cannot get.

In general, if there are

kchildren, then the highest number toffee that we can say for certain the dog will not get is toffeek².