In a room, there are 1000 bulbs numbered from B1 to B1000, initially all are off. There are 1000 persons present in that room, numbered from P1 to P1000. The first person (P1) comes and switches on all the bulbs, then the second guy (P2) comes and switches off every second bulb (ie. bulbs B2, B4, B6....). Then P3 comes and he alters the state of every third bulb (B3, B6, B9....). This process goes on till P1000, when finally P1000 comes and he operates on only B1000. After everybody is done, how many bulbs will remain switched on ?
3-Ans- Let us consider what happens to the 12th bulb (B12) :
Initially B12 is off
--1)P1 switches it on.
--2)P2 switches it off.
--3)P3 switches in on.
--4)P4 switches it off.
--5)P6 switches it on.
--6)P12 switches it off finally.
Again, consider what happens to the 16th bulb (B16) :
Initially B16 is off
--1)P1 switches it on.
--2)P2 switches it off.
--3)P4 switches in on.
--4)P8 switches it off.
--5)P16 switches it on finally.
Thus from the above two cases we observe that the bulb will remain switched on finally if ODD number people operate on it, otherwise it be switched off.
The number of people operating on the bulb BK depends on the number of factors of K.
Now, square numbers have ODD number of factors (like, 16 has 5 factors: 1,2,4,8,16), and non-square numbers have EVEN number of factors (like 12 has 6 factors: 1,2,3,4,6,12).
Thus bulbs which are marked with square numbers (B1, B4, B9, B16 ..., B900, B961) will remain switched on and rest will be switched off.
So, the total number of bulbs remaining switched on finally is: 31 (as 31x31 = 961 is the biggest square number within 1000).