@Ipeq1 Ok I've read it now. It does give more insights, especially seeing the (5) drop out and the others staying because you can "waste" a move with them. One of these insights is that I'm now more convinced that my 1+m*n really doesn't make sense :-). Looks more and more like I really just found a nice formula for something that itself is really not nice.
I was somewhat hoping it would be like for the problem of xor-ing the integers from 0 to n. If you do that, i.e., print out the results and observe the pattern, you'll see an easy pattern as well. But there the pattern is very much meaningful.
Of course one key difference is that in the xor-problem the n can go arbitrarily high. In this problem here, my 1+m*n is so quickly dominated by 1<<3. Not much of a pattern if it's just a handful of values. Oh well, I still like it for being so short.
@coder42 The first operation repeats every 1 light. The second and third operations repeat every 2 lights. The fourth operation repeats every 3 lights. In total, they must all repeat every lcm(1, 2, 2, 3) = 6 lights.