$n$ boxes initially contain $1,2, \ldots, n$ marbles respectively ( $n \geq 1$ ). Charlotte first adds a marble to each box. Then she adds a marble to each box in which the number of marbles is divisible by 2 , then a marble to each box in which the number of marbles is divisible by 3 , and so on, until she adds a marble to each box in which the number of marbles is divisible by $n$. For which values of $n$ does the procedure end with exactly $n+1$ marbles in every box?
The answer is: all $n$ such that $n+1$ is prime.

Lemma 1. If box $A$ is to the left of box $B$ (we can arrange the boxes so that they initially contain $1, \ldots, n$ marbles respectively from left to right), then at no stage of the process can box $A$ have more marbles than box $B$.

Proof. At the outset box $A$ certainly has fewer marbles than box $B$. Each subsequent stage adds at most one marble to each box, with one of two outcomes: (1) $A$ still has fewer marbles than $B$; (2) $A$ and $B$ have the same number of marbles, at which point the rules force $A$ and $B$ to have the same number of marbles throughout the process. This proves the lemma.

In view of this lemma, for all the boxes to end up with $n+1$ marbles, it is necessary and sufficient for the first box and the last box to end up with $n+1$ marbles. The first box will certainly have $n+1$ marbles because Charlotte adds a marble to it
on every turn. The last box, which begins with $n$ marbles, will have $n+1$ after the first turn. If $n+1$ is prime, then since it is not divisible by any of the numbers $2,3,4, \ldots, n$, the box will not pick up any more marbles and thus will end up with $n+1$. Then the intervening boxes, being sandwiched between two boxes with $n+1$ marbles, will also have $n+1$ marbles.

If $n+1$ is composite, then it is divisible by one of the numbers $2,3,4, \ldots, n$. Hence the box will pick up another marble and will finish with at least $n+2$ marbles.