There are $n$ children around a round table. Erika is the oldest among them and she has $n$ candies, while no other child has any candy. Erika decided to distribute the candies according to the following rules. In every round, she chooses a child with at least two candies and the chosen child sends a candy to each of his/her two neighbors. (So in the first round Erika must choose herself). For which $n \ge 3$ is it possible to end the distribution after a finite number of rounds with every child having exactly one candy?
Equations => Arithmetic progression
Label all the people $1$, $2$, $3$, ..., "n". Then, let the number of times that each person gives to his or her neighbors (with an end result of everyone having 1) be $a_1$ for person 1, $a_2$ for person 2, ..., $a_n$ for the last person. We see that the situation may be modeled by the system of equations
\begin{align*} n - 2a_1 + a_n + a_2 &= 1\\ -2a_2 + a_1 + a_3 &= 1\\ -2a_3 + a_2 + a_4 &= 1\\ ... && \\ -2a_{n-1} + a_{n-2} + a_n &= 1\\ -2a_n + a_{n-1} + a_1 &= 1\end{align*} Then, subtracting each pair of equations:
\begin{align*}n + 3a_2 + a_n &= 3a_1 + a_3\\ 3a_3 + a_1 &= 3a_2 + a_4\\ ... &&\\ 3a_n + a_{n-2} &= 3a_{n-1} + a_1\\ 3a_1 + a_{n-1} &= 3a_n + a_2 + n\end{align*} Rearrange each equation:
\begin{align*}n + 3(a_2 - a_1) &= a_3 - a_n = (a_3 - a_2) + (a_2 + a_1) + (a_1 - a_n)\\ 3(a_3 - a_2) &= a_4 - a_1 = (a_4 - a_3) + (a_3 - a_2) + (a_2 - a_1)\\ &...& \\ 3(a_n - a_{n-1}) &= a_1 - a_{n-2} = (a_1 - a_n) + (a_n - a_{n-1}) + (a_{n-1} - a_{n-2})\\ 3(a_1 - a_n) &= a_2 - a_{n-1} + n \ \ (1) \end{align*} Now
\begin{align*}2(a_3 - a_2) &= (a_4 - a_3) + (a_2 - a_1)\\ 2(a_4 - a_3) &= (a_5 - a_4) + (a_3 - a_2)\\ &...& \\ 2(a_n - a_{n-1}) &= (a_1 - a_n) + (a_{n-1} - a_{n-2})\end{align*}
We can see from the first equation that $(a_2 - a_1)$, $(a_3 - a_2)$, and $(a_4 - a_3)$ is an arithmetic progression. From the second equation, $(a_3 - a_2)$, $(a_4 - a_3)$, and $(a_5 - a_4)$ is an arithmetic progression, and so on. Since the difference between $(a_3 - a_2)$ and $(a_4 - a_3)$ is constant, we have four terms in an arithmetic progression. Continuing on,
\[a_2 - a_1, a_3 - a_2, a_4 - a_3, ..., a_n - a_{n-1}, a_1 - a_n\] is an arithmetic progression.
Determine some conditions on n
Now remember that we have another equation we can use: $3(a_1 - a_n) = a_2 - a_{n-1} + n$, which was equation (1). Since $a_1 - a_n = c + (n-1)d$ and
\begin{eqnarray*}a_2 - a_{n-1} &=& (a_2 - a_1) + (a_1 - a_n) + (a_n - a_{n-1})\\ &=& c + c + (n-1)d + c + (n-2)d\end{eqnarray*} we see that
\[3(c + (n-1)d) = 3c + (n-1)d + (n-2)d + n\] This equation simplifies to $nd = n$ or $d = 1$, since $n \neq 0$.
Back to the arithmetic progression:
Let $a_2 - a_1 = c$, $a_3 - a_2 = c + d$, ..., $a_n - a_{n-1} = c + (n-2)d$, $a_1 - a_n = c + (n-1)d$. We see that the sum of all the terms is 0, since everything cancels out. So
\[nc + \frac{(n-1)n}{2} \cdot d = 0\] Note that $n \neq 0$. So $c + \frac{n-1}{2} \cdot d = 0$.
Ok: so $d=1$. This means that $c = -\frac{n-1}{2}$. Note that $a_2$ and $a_1$ are integers. So $c$ is an integer. Thus, $n$ must be odd.
All odd n work
We now show (rather non-rigorously here, IMO) that all odd n work. Let $n = 2a + 1$. Have "Erika" = person 1 at the head of a symmetric table, like
_____1_____
2a+1______2
2a________3
......
person____person
For notation, suppose that $b_k$ is when person k and person 2a+3-k gives objects. For $b_1$, this is just when person 1 only gives objects.
So we start with 1 having $2a+1$ objects:
2a+1
0__0
0__0
........
0__0
First have 1 give objects $a$ times. This is $b_1$ repeated $a$ times. Here's the end result (shown is the number of objects):
1
a, a
0, 0
...
0,0
(with 1 having 1 object left; 2, 2a having $a$ objects now; everyone else having 0)
Now have the process $(b_2, \ \text{then} \ b_1)$ be repeated a-1 times. Here's the end result (shown is the number of objects):
1
1,1
a-1, a-1
0,0
...
0,0
The idea is that we have the process $b_1$ repeated $a$ times, followed by $(b_2, \ \text{then} \ b_1)$ repeated $a-1$ times, followed by $(b_3, \ \text{then} \ b_2, \ \text{then} \ b_1)$ repeated $a-2$ times, etc..., until we have $(b_n, \ \text{then} \ b_{n-1} \, ..., \ \text{then} \ b_2, \ \text{then} \ b_1)$ repeated once. The result should lead to
1
1,1
1,1
...
1,1
Edited numerous times for notation, a few incorrect/confusing parts, formatting
<< below there's an incorrect solution I believed it worked. However, it's completely wrong.
Let's prove this process is impossible for $2|n$. Let's assign each person weights: first gets 1, second -1, third 1 and so on; last gets -1. The value of the state is sum of (i-th child's weight)*(candies i-th person have). Initially, it's equal to $n$. Furthermore, it's invariant under the operation. Finally, the value must be equal to 0 - contradiction.
No, it's not an invariant. Applying a single move causes the value to change by a number divisible by $4$. (Just try it to the original state; performing a single move will make the value $n-4$.)
Thanks, I don't know why I thought it was correct :/ I must do everything slower so as to do it better...
Let's try another short proof:
Again we prove that $2|n$ gives contradiction. Set the weights such that i-th child gets the weight i (i=1,2,...,n). At first, the value as defined before (sum of (i-th weight)*(i-th child's candies)) is $n$. We want $\frac{1}{2}n(n+1)$. Each time the value can decrease by $n$ (if we take candies from child #n), increase by $n$ (if we take from #1) or remain unchanged otherwise. So the value (mod n) remains invariant. It means that $\frac{1}{2}n(n+1) \equiv n \pmod{n}$, so $n | \frac{1}{2}n(n+1)$, so $2|n+1$ - contradiction.