Use Binary sequences ( a sequence of ones and zeroes) to help visualize.
Someone flips the switch on every single lightbulb
Every lightbulb starts turned on. ON is 1, OFF is 0.
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Someone flips the switch on every other lightbulb
Someone flips the switch on every third lightbulb
Someone flips the switch on every fourth lightbulb
This means that LCM of 2, 3, 4,. Which is 12.
A binary sequence of 12 terms would repeat in the a hundred light bulbs.
So lets have 12 light bulbs.
101010101010 Someone flips the switch on every other lightbulb
100011100011 Someone flips the switch on every third lightbulb
100111110010 Someone flips the switch on every fourth lightbulb
There are 7 out of 12 lightbulbs that are turned on.
Now we have a pattern of 100111110010 repeating until the number of terms is 100. We have to find the number of 1s in that 100-length pattern.
Every 12 terms that are seven 1s.
So 12 * 8 = 96
8 * 7 = 56
So out of 96 terms, 56 are 1s.
There are 4 more terms.
Counting up the pattern 100111110010 four terms, we have two 1s.
So 56 + 2 = 58
58 light bulbs are turned on