![](/content/sites/plus.maths.org/files/styles/small_square/public/cake_frontpage_1.jpg?itok=amnTjJuD)
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.
![Cake](/content/sites/plus.maths.org/files/news/2016/cake/cake.jpg)
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 $k$ people having $n_1, n_2, ...,n_k$ cakes respectively, who are then joined by another $m$ people who pay $n_1+n_2+n_3+...+n_k$ coins each?