Leonardo of Pisa, also known as Fibonacci, recounts that he was given this problem by John of Palermo as part of a mathematical tournament.

Three men possess a pile of money, their shares being 1/2, 1/3, 1/6. Each man takes some money from the pile until nothing is left. The first man returns 1/2 of what he took, the second 1/3 and third 1/6. When the total so returned is divided equally among the men it is found that each then possesses what he is entitled to. How much money was in the original pile, and how much did each man take from the pile?

Note: This is a Diophantine problem so you may just give the smallest whole number solution.

I'll call the three men Alex, Bert, and Carl. At each step of the series the sum of the three mens' shares plus the pile equals the total: Alex + Bert + Carl + Pile = Total. Let the total be 1 for now; I will adjust for integers at the end.

At the end the distribution is:

(1/2) + (1/3) + (1/6) + (0) = 1

Let x be the amount each man got in the previous step. Then before this the distribution was:

(1/2-x) + (1/3-x) + (1/6-x) + (3x) = 1

Prior to this each man put a proportional amount to make the pile. Before adding to the pile Alex had 2 times what he had after, Bert had 3/2 as much, and Carl had 6/5 as much. Then the distribution before adding to the Pile is:

2*(1/2-x) + (3/2)*(1/3-x) + (6/5)*(1/6-x) + (0) = 1

This represents the original amounts each man took. Solving this equation yields x=7/47. This implies the original amount is a multiple of 47 for all the transactions to be integers. The original amount must also be a multiple of 6 for the shares each man takes. Then 47*6 = 282 is the smallest candidate for the original pile.

With a total of 282 then Alex took 282*2*(1/2-7/47) = 198 initially, put in 99, recieved 42, making his final share 198-99+42 = 141, which checks with 282/2 = 141.

Bert then took 282*(3/2)*(1/3-7/47) = 78 initially, put in 26, recieved 42, making his final share 78-26+42 = 94, which checks with 282/3 = 94.

Carl then took 282*(6/5)*(1/6-7/47) = 6 initially, put in 1, recieved 42, making his final share 6-1+42 = 47, which checks with 282/6 = 47.

In summary, the pile started with 282 where Alex, Bert, and Carl initially took 198, 78, and 6 respectively.