The following is a well-known riddle:
As I was going to Saint Ives,
I met a man with seven wives,
Every wife had seven sacks,
Every sack had seven cats,
Every cat had seven kits,
Kits, cats, sacks, wives.
How many were going to Saint Ives?
The riddle is amphibolous; it isn't clear who exactly is to be counted as going to St. Ives, so there is no single clear answer. For example, if we assume that all of the other people are going away from St. Ives, the answer would be 1 (the person telling the riddle). If we count the man, the wives, sacks, cats, and kits as all going to St. Ives (but omit the person telling the riddle), the answer is: 1 + 7 + 7² + 7³ + 74 = 2,801. Other solutions are also possible. An interesting exercise in lateral thinking would be to think of as many different solutions as possible.
Curiously enough, a very similar problem occurs in the Rhind Papyrus, one of the surviving documents detailing ancient Egyptian mathematics. In problem 79, while the problem is difficult to read and interpret, it appears to ask the solver to determine the total number of houses, cats, mice, spelt, and hekat in 7 houses, where the numbers increase by a factor of 7 each time.
As well, a problem in Liber Abaci by Fibonacci is quite similar. It reads something along the lines of:
There are seven old women on the road to Rome. Each woman has seven mules; each mule carries seven sacks; each sack contains seven loaves; with each loaf are seven knives; and each knife is in seven sheaths. Women, mules, sacks, loaves, knives, and sheaths, how many are there in all on the road to Rome?
Most likely all three problems were created independently of each other; it would not be possible for either Fibonacci or the creator of the St. Ives riddle to know about the Rhind Papyrus, and it seems unlikely that the creator of the St. Ives riddle knew about Fibonacci either.
In some versions of the riddle, "seven" is replaced with "nine" or "fifty." Other versions omit the man, as in the following version:
As I was going to St. Ives,
There I met fifty old wives,
Every wife had fifty sacks,
Every sack had fifty cats,
Every cat had fifty kittens.
Kittens, cats, sacks and wives,
How many were going to St. Ives?
Sometimes, the wording is slightly different (for example, sometimes "each" is used instead of "every").
Sources used (see bibliography page for titles corresponding to numbers): 35, 36.