**From New Scientist #1213, 7th August 1980** [link]

Three pairs of brothers went off or a day’s fishing and each pair caught the same number of fish between the two of them. Anglers are not everyone’s first choice for guardians of truth, however, and the table above needs a pinch of salt. It records what each man (listed down the left) claimed that three men (listed across the top) had caught. (For instance, Charles claimed that Bert had caught 11). To sort it out, you need to know that each always states his brother’s catch correctly but overstates his own and understates anyone else’s.

Who really caught how many?

[enigma70]

### Like this:

Like Loading...

*Related*

This Python program examines all possible pairings of the brothers. It then uses a class representing intervals to track the minimum and maximum possible values for each fisherman. If the interval holds no values then an exception is raised (by using Python’s

`assert`

construct, in a “real” program I would define my own exception), and the code moves on to the next possibility.Interval.__iter__()can be implemented usingyield from ...in Python 3.3, but here I implemented it with a loop so the program will also run under Python 2.7.The output code takes into account the fact that multiple values may arise from the intervals – although it turns out there is a single solution, so for solving this particular puzzle the code could be simplified.

This code runs in 38ms.

Solution:Each pair caught 18 fish. The pairs are: A caught 8, D caught 10; B caught 12, F caught 6; C caught 7, E caught 11.Using the

partitions()routine recently added to myenigma.pylibrary thegenerate()function could be written as:This one looked quite hard so I fancied having a go at it: