Problem 6
There are lamps in a circle, where and . At step , if is lit, switch , otherwise do nothing. Initially all lamps are on. Show that (a) there is a positive integer such that after steps all lamps are on again; (b) if , take ; (c) if , take .
Step 5 of 5: Evaluate the one-more-than-a-power case
In plain words
Adding one coordinate changes the cancellation count by exactly n-2.
Detailed analysis
The same recurrence, now with one extra cyclic coordinate, has one endpoint overlap. The repeated-squaring calculation leaves exactly n^2-n+1 updates on the all-one state, after which every bit is again 1. This proves the second stated bound.