We'd like to thank Syed Abbas, Associate Professor and Chairperson SBS, IIT Mandi, India, for sending in this puzzle. Reportedly, a version of it was put to Ali ibn Abi Talib in the seventh century AD. Another version appears in Fibonacci's famous Liber Abaci.

Two people on a long walk sit down for a well-deserved break. Person A has brought along 3 cakes to eat and person B has brought along 5 cakes.
As they are just about to tuck in person C arrives and asks to share their meal. A and B agree. They cut each cake into three equal pieces and each person eats one piece of each cake.
After the meal person C pays 8 coins for the cake. Person A gives 5 of these coins to person B and keeps 3 for himself. But person B complains. She demands to be given 7 of the coins with only 1 remaining for A.
Who is right and why?
Can you generalise the solution for an initial people having
cakes respectively, who are then joined by another
people who pay
coins each?
Answer
I think that person A is correct as each coin should contribute to a cake
Answer
I think person A in corect as each coin should be worth a cake.
Math
Person A is right because each coin should equal 1 slice.
No bro A person also eats 2…
No bro
A person also eats 2 extra slice from person b so he should give him 2 coins extra
Maths
Person c paid 8 coins meaning for 8/3 proportion of cake equals 8 coins.
Therefore, if we count what person A contributes it comes to 1/3 portion after subtracting his share for food. It means he should get 1 coin.
Person B is final score comes at 7/3 meaning she should get 7 coins.
B is right
C is paying 8 coins for 8/3 cakes, of which 1/3 is contributed by A and 7/3 by B. To fairly share these coins, A should get 1 and B should get 7.