find an invariant

257 Views Asked by At

I've been reading about the use of invariants in contest math. I saw the following problem (in my own words):

There are $N = 2n$ numbers placed on a circle. Then we increase two any consecutive numbers by 1. Is it always possible repeating this procedure to get all numbers to be equal to $SomeNumber$?

The solution is to build an invariant $I = a_1-a_2+a_3-a_4...$. $I$ will always remain constant. For example, the initial numbers are 1,5,2,3 and we want all numbers to be 11. Then $I = 1 -5 + 2 -3 - = -5$ and if all the numbers were $11$ the invariant $I$ would be $0$. Which shows that it's impossible to make all numbers be $11$.

Q: I've been asking myself what invariant we would have to use if we were allowed to change $3$ consecutive numbers instead of $2$. The previous invariant doesn't work in this case because it would change by $\pm 1$.

1

There are 1 best solutions below

3
On BEST ANSWER

Hint In the first version of the problem, in which one adds $1$ to two consecutive numbers, the residue of $\sum_{i = 1}^N a_i$ modulo $2$ (i.e., the parity of the sum) is also an invariant under the operation. (Indeed, this is just the parity of $I$.)