**From New Scientist #1527, 25th September 1986** [link]

I fell asleep during a lecture and dreamed that I was out in the country. In my dream I saw a field and in this field some four-legged cows being milked by at least one two-legged milkmaid who had the use of a number of three-legged stools. There were more stools than would suffice for one per milkmaid, and more cows than would suffice for one per milking stool.

Given this information, and the number of legs in the collection, I realised that one could work out unambiguously the number of cows, stools and milkmaids in the field. Furthermore, the number of legs in the field was the largest it could have been, consistent with these facts.

I awoke with quite a start when the lecturer addressed a question to me. Unfortunately, the answer I gave to his question was the number of cows, milking stools and milkmaids that I had dreamed of. Of course, everyone laughed, but I bet they wouldn’t be able to solve that in their sleep!

How many milkmaids were there in my dream, and how many milking stools and cows?

[enigma378]

### Like this:

Like Loading...

*Related*

This Python program runs in 54ms.

Solution:There was 1 milkmaid, 3 stools and 7 cows.So, the largest unique value for the number of legs is 39.

If the declared order had been different we could have had

1 cow, 2 stools, 7 maids (24 legs)

2 stools, 3 cows, 6 maids (30 legs)

1 cow, 4 maids, 7 stools (33 legs)

1 maid, 4 cows, 7 stools (39 legs again)

2 stools, 4 maids, 7 cows (42 legs).

I admit that those don’t make very good farming practice.

Such is the stuff as dreams are made on.

This is a variation on a problem known as the Frobenius problem (see here), for which I have a solver in my Number Theory Library.