3. Let $a, b$ be two natural numbers, and there are $a b$ candies. Pack these candies into several packs so that these candies can be divided into $a$ portions, each with $b$ candies, or these candies can be divided into $b$ portions, each with $a$ candies. Find the minimum number of all possible pack numbers.


3. Solution: Arrange $ab$ candies in a row, and draw a line after the $a, 2a, \cdots, (b-1)a$ candies, and draw a line after the $b, 2b, \cdots, (a-1)b$ candies. Pack the parts separated by the lines into one pack each. In this case, the condition is satisfied, and the number of packs is $(a-1)+(b-1)-\left(\frac{ab}{[a, b]}-1\right)+1=a+b-(a, b)$. Therefore, the minimum value $\leqslant a+b-(a, b)$.

Next, assume the minimum number of all packs is $K$. For a certain division with $K$ packs, label these $K$ packs as $1, 2, \cdots, K$, and wrap them in white paper. Similarly, label another set of $K$ packs as $1, 2, \cdots, K$, and wrap them in yellow paper. The number of candies in the white and yellow packs with the same label is equal. We will use graph theory to prove that $K \geqslant a+b-(a, b)$.

Divide the $K$ white packs into $a$ groups, each containing $b$ candies, and divide the $K$ yellow packs into $b$ groups, each containing $a$ candies.

Place the $a$ groups of white packs on the left and the $b$ groups of yellow packs on the right. Connect a line between the groups containing the same labeled small packs, which must form a simple graph. If it is not a simple graph, i.e., there are two or more same-labeled packs between a white group and a yellow group, combine these packs into one, reducing the number of packs while still satisfying the condition, which contradicts the minimality of $K$! Therefore, it must be a simple graph.

In the graph, there are $a+b$ points. Consider a connected subgraph in this graph. In this subgraph, if the $i$-th pack is in a white group, it must also be in a yellow group, and vice versa. The total number of candies in all white groups is a multiple of $b$, and the total number of candies in all yellow groups is a multiple of $a$, so it is a multiple of the least common multiple of $a$ and $b$. Hence, the number of connected subgraphs is at most $\frac{ab}{[a, b]}=(a, b)$.

Since the number of edges in a connected graph is at least the number of points minus 1, and it can be divided into at most $(a, b)$ parts, the number of edges is at least $a+b-(a, b)$. Therefore, $K \geqslant a+b-(a, b)$.
In conclusion, the minimum value is $a+b-(a, b)$.