My second answer is
7 cuts if the peices can be moved before each cut.
Suppose the cake is first cut into 9 equal pieces.
If only 8 guests arrive, one spare piece must also be cut into 8 equal portions.
If only 7 guests arrive, two spare pieces must also be cut into 7 portions each.
It takes 4 cuts to divide into 9 pieces (not always through the centre):
1 $\frac{4}{9} \frac{5}{9} $
2 $\frac{2}{9} \frac{2}{9} \frac{2}{9} \frac{3}{9} $
3 $\frac{1}{9} \frac{1}{9} \frac{1}{9} \frac{1}{9} \frac{1}{9} \frac{1}{9} \frac{1}{9} \frac{2}{9} $
4 halve the single $\frac{2}{9} $ into $\frac{1}{9} \frac{1}{9}$
Put 6 of the pieces to one side, and work with the 3 remaining pieces.
One needs to be cut into 8 portions and the others into 7 portions:
5 $ \frac{4}{8} \frac{4}{8} \frac{4}{7} \frac{3}{7} \frac{4}{7} \frac{3}{7} $
6 $ \frac{2}{8} \frac{2}{8} \frac{2}{8} \frac{2}{8} \frac{2}{7} \frac{2}{7} \frac{2}{7} \frac{1}{7} \frac{2}{7} \frac{2}{7} \frac{2}{7} \frac{1}{7} $
Put the two $\frac{1}{7} $ pieces to one side, and halve the remaining ones:
7 $ \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{8} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7} \frac{1}{7}$
My first answer was >! **9 cuts** >! >! The lowest common multiple of the possible guests is $7 \times 8 \times 9 = 504$. >! If you move pieces so that every cut halves every piece, **9 cuts** will make $2^9 = 512$ pieces. >! >! If $8$ guests arrive, you serve $8 \times 64 = 512$ pieces. >! >! The others are more tricky. Based on the assumption that cake is soft and crumbly, and it is not possible to cut pieces exactly in half, then: >! >! For $7$ guests, if you serve $7 \times 73 = 511$ pieces, there would be one piece remaining. So serve the $74$ smallest pieces to one guest, and $73$ at random to each of the other guests. >! >! For $9$ guests, if you serve $9 \times 57 = 513$ pieces, there would be one piece short. So serve the $56$ largest pieces to one guest, and $57$ at random to each of the other guests. >! >! To make it easy when the guests arrive, you can already have sorted out the $74$ smallest pieces into one pile and the $56$ largest pieces into another pile. Depending on how many guests arrive, you dump one or both of these piles into the main heap.