### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 175,242 hits

Advertisements

Programming Enigma Puzzles

21 February 2012

Posted by on **From New Scientist #2730, 17th October 2009** [link]

A group of friends and I each had a half-pint of shandy (beer mixed with lemonade), but the proportion of lemonade to beer varied from glass to glass. Overall, I had a certain whole-number percentage of the lemonade used in the round of drinks, and a certain whole-number percentage of the beer. The percentage of beer was 5 more than that of the lemonade.

If I now told you the actual percentages it would be possible to work out how many of us there were in the group.

Knowing that, if instead I now told you how many of us there were, you could work out the percentages.

How many of us were there, and what percentage of the lemonade did I have?

[enigma1567]

Advertisements

%d bloggers like this:

The following Python program runs in 37ms.

Solution:There were 6 people. You had 15% of the lemonade.I can’t see that we have enough information to solve this. We don’t know whether each other person received an integer percentage of the total amount of either beer or lemonade, or each had an integer number of fluid drachms (or any other curious unit one cares to name) of each ingredient, nor whether the proportion of lemonade to beer in any or all of the glasses was an integer percentage or even a rational number. We don’t even know the ratio of the total amounts of lemonade and beer. Therefore it appears that there could be infinitely many ways of dividing up whatever is left in the jugs after the one drink has been poured. What am I missing?

If the initial amounts of lemonade and beer (measured in half pints, but not necessarily integers) are

LandB, respectively. And there arenpeople needing drinks altogether.Then the setter has an integer percentage of both the lemonade and the beer to make a half pint.

So, suppose the setter has

k/100of the lemonade and(k+5)/100of the beer to make up his half pint.now

B> 0, andL> 0:So, for a given value of

k > 0we have:If we are given

k(an integer from 0 to 100), we can determine the possible range forn(a positive integer), without the need to calculateLorB.And we are told that if we given

k, there would be a unique corresponding value ofn.The only single values for

n, are when:So

(k, n)must be one of the pairs above.We are then told that if we were told

nwe could determinek.So the only possible pair is

(k, n) = (15, 6).Plugging these numbers back into the equations we get:

B = 2, L = 4, i.e. initially there were 2 half pints (1 pint) of beer and 4 half pints (2 pints) of lemonade.Many thanks for your swift response, Jim. I’ll now read that through (slowly!) and try to understand it. Numerical integration and even singular-value decomposition are simple in comparison to some of these Enigmata (I’m opting for a Greek plural in line with the expression “it’s all Greek to me”).