You are organizing a party. However, the number of guests to attend your party can be anything from $a_1$, $a_2$, $\ldots$, $a_n$, where the $a_i$'s are positive integers. You want to be prepared, so you want to cut a cake into smaller pieces. The pieces are not necessarily of equal size. The requirement is that, no matter how many guests come (which you will have known before distributing the cake), you will be able to give each of them some pieces of the cake without having to cut the cake any further so that everybody will get the same amount of cake. What is the minimum number of pieces of your cake you will have to cut it into?
Trivially, if $n=1$, then the answer is $a_1$. The answer is also known for $n=2$, which is $a_1+a_2-\gcd\left(a_1,a_2\right)$ (if you wonder why graph theory is in the tag, it is because the only proof known to me for the $n=2$ case is done via a graph-theorical argument). I conjecture that the answer, in general, is $$m:=\sum_{j=1}^n\,(-1)^{j-1}\,g_j\,,$$ where $$g_j:=\sum_{1\leq k_1<k_2<\ldots<k_j\leq n}\,\gcd\left(a_{k_1},a_{k_2},\ldots,a_{k_j}\right)$$ for $j=1,2,\ldots,n$ (here, $g_1$ is simply $a_1+a_2+\ldots+a_n$). It is easy to cut the cake into $m$ pieces to satisfy the required condition.
Apparently, the conjecture is false for $n>2$ (see Dividing the whole into a minimal amount of parts to equally distribute it between different groups.). However, I expect that my guess is not far away from the correct answer.
EDIT: The $n=2$ case with $\gcd\left(a_1,a_2\right)=1$ appeared as a problem for the Spring Contest, A Level, of the Tournament of the Towns of 1990. See https://keoserey.files.wordpress.com/2012/12/imtot-book-3.pdf (page 35 of the PDF).
Related Topics:
Dividing the whole into a minimal amount of parts to equally distribute it between different groups.
https://puzzling.stackexchange.com/questions/19870/nine-gangsters-and-a-gold-bar/19881#19881
This is a proof for the case where $n=2$, as requested by vonbrand.
Consider a bipartite graph graph $G\left(V_1\cup V_2,E\right)$, where $V_1$ and $V_2$ are bipartite sets with $\left|V_1\right|=a_1$ and $\left|V_2\right|=a_2$ such that they represent the guests who may attend the party and $\left\{v_1,v_2\right\}$ with $v_1 \in V_1$ and $v_2\in V_2$ are in the edge set $E$ if and only if there exists a piece of this cake that will be given to $v_1$ if $a_1$ guests come such that this same piece will be given to $v_2$ if $a_2$ guests come. Clearly, we need at least $|E|$ pieces of cake. We shall verify that $|E|\geq a_1+a_2-d$, where $d:=\gcd\left(a_1,a_2\right)$. It suffices to show that there are at most $d$ connected components in $G$.
Suppose that $C$ is a connected component of $G$. Write $C_1$ for the set of vertices of $C$ in $V_1$ and $C_2$ for the set of vertices of $C$ in $V_2$. Each guest in $V_1$ takes $\frac{1}{a_1}$ amount of cake, while each guest in $V_2$ takes $\frac{1}{a_2}$ amount of cake. Hence, the total amount of cake given to guests in $C_1$ is $\frac{\left|C_1\right|}{a_1}$, while the total amount of cake given to guests in $C_2$ is $\frac{\left|C_2\right|}{a_2}$. Since $C$ is a connected component, guests in $C_1$ must consume the same amount of cake as that consumed by guests in $C_2$; otherwise, there will be an edge going from $C_1$ or $C_2$ to a vertex outside $C$. Ergo, we must have that $$\frac{\left|C_1\right|}{a_1}=\frac{\left|C_2\right|}{a_2}\text{ or }\frac{a_2}{d}\left|C_1\right|=\frac{a_1}{d}\left|C_2\right|\,.$$ Hence, $\frac{a_1}{d}$ divides $\left|C_1\right|$, as $\gcd\left(\frac{a_1}{d},\frac{a_2}{d}\right)=1$. Thence, $\left|C_1\right| \geq \frac{a_1}{d}$ (and similarly, $\left|C_2\right| \geq \frac{a_2}{d}$).
Consequently, every connected component of $G$ has at least $\frac{a_1}{d}$ vertices in $V_1$. Hence, $G$ can have at most $d$ connected components. The proof is now complete.
P.S. You can probably see why this sort of arguments won't work for $n>2$. If we try to create $n$-partite graphs in the same way, then the number of pieces of cake is related to the number of $n$-cliques of this graph. However, not all $n$-cliques can be assigned to a piece of cake, and two distinct pieces of cake can produce two non-identical, but non-disjoint, $n$-cliques. Hence, for $n>2$, I think we need a completely new way to solve the problem. We might be able to use $n$-uniform hypergraphs in tackling the case $n>2$.