I dont know how to do it mathematically but the word retracing caught my eyes
i retraced the sequence
and obtained the following figure
let all lamps are lit
steps(each cycle) no. of lamps
(1 on)(0 of)
1111(initially all lamps are lit)
(steps are retraced ) 1000
1100
1010
1111
after every one in previous step of previous column change the state
11
0
as you can see
that for 4 lamps
after 4 steps back lamps are relit
proceed same way you get for power of 2
I dont know how to write it mathematically
but can these tupe of question come in IIT