# Universal pie division [duplicate]

Following this well known puzzle: The seven piece silver chain, there is much harder puzzle about optimal division:

Alice has baked a big pie and invited all 9 friends of her.
7 of them will come for sure, but situation with other 2 is unclear, may be they both come, may be only one of them, may be - none.
Alice wants to cut the pie in advance, also she wants to make the smallest possible number of pieces and be able to distribute the whole pie evenly among all her friends (with no additional cuts). How should she cut the pie?

For example, Alice can divide the pie into 7x8x9=504 pieces of equal size and then, if 7 friends came then give 72 pieces to each friend, if 8 friends came - 63, if 9 - 56. But I can ensure you that Alice is going to create much less amount of pieces :)

Additionally: can you solve more general puzzle: divide a pie so it can be distributed evenly among K, M and N people? I haven't tried it yet, but it could be possible...

P.S. Common, people... stop hacking the puzzle :( this is not a riddle. Just find a smallest group of numbers, which can be grouped to 7 subgroups with sum of numbers in each subgroup of 72, or 8 with sum of 63, or 9 of 56.

• is the answer 'with a knife?'
– JMP
Jun 25 '16 at 13:25
• @JonMarkPerry, it feels like this community lacks ThisIsNotARiddle tag... Jun 25 '16 at 13:31
• Won't she eat some pie herself? Jun 25 '16 at 13:34
• I think we all understand what exactly the OP wants to say, don't we? Jun 25 '16 at 13:35
• @Ankoganit, yes. Jun 25 '16 at 13:41

Just to start this off in a fair way.

Alice can manage with:

$22$ pieces.

Let Alice make the following pieces:

$7$ pieces each $\frac 19$ of the pie,
$6$ pieces each $\frac{1}{56}$ of the pie,
$8$ pieces each $\frac{1}{72}$ of the pie,
$1$ piece, $\frac{1}{252}$ of the pie.

If $7$ friends arrive, we can do as follows:

$\frac 19+\frac{1}{56}+\frac{1}{72}$ to each of $6$ friends;
$\frac 19+\frac{1}{72}+\frac{1}{72}+\frac{1}{252}$ to the last one.

If $8$ friends arrive, we give:

$\frac{1}{9}+\frac{1}{72}$ to each of $7$ friends;
and the rest to the last one.

If $9$ friends, we can divide as follows:

$\frac 19$ to each of $7$ friends;
$8$ pieces, each $\frac{1}{72}$ of the pie, to one friend; and the rest to the last one.

However, this may not be the optimal one.

• This definitely can be improved. Several times ;) Jun 25 '16 at 14:08