### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,115)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,357 hits

Programming Enigma Puzzles

21 May 2015

Posted by on **From New Scientist #1429, 8th November 1984** [link]

Apart from providing the beer at my birthday party, I decided to encourage the abstemious by paying every guest a bounty of 10p for every pint drunk by someone else

minus20p for every pint he drank himself. I can’t remember all the details, but I do know that I paid out £9 in bounty altogether. Each guest drank a different odd number of pints, and everyone received some bounty money except David, who consumed so much beer (no one else’s consumption was within 3 pints of his) that he got exactly nothing in bounty.From that information you can probably work out just how much each guest drank. If you do, please let me know.

[enigma282]

Advertisements

%d bloggers like this:

Using units of 10p, if we have

npeople who drinkp_1, p_2, …, p_npints (lets say in descending order).Then, if

tis the total number of pints drunk:And the bounty for the

k-th person is:David, the person who drinks the most, gets zero bounty, so:

Also the total of all the bounties is 90 units:

So we can consider the divisors of 90.

This Python3 program runs in 54ms.

Solution:The guests drank (in decreasing numbers of pints): 15 pints (David), 11 pints, 9 pints, 7 pints, 3 pints.So, a total of 45 pints were consumed by the 5 guests. (Quite a boozy party).

The corresponding bounties are: 0p (for David), £1.20, £1.80, £2.40, £3.60.

I’m not quite sure why the setter wrote “from that information you can

probablywork out just how much each guest drank” – maybe he had had a couple of pints too many himself.