so there are 10,000 lamps in one line with an on/off switch on each lamp and 10,000 people are in row standing next to the lamps. The lamps are off. So the first person goes (one by one, people go), and stops by every lamp (changes the current state:turns on every lamp). The second person stops by every second lamp starting from the second and changes the state of each of those lamps. The third goes and stops by every third.. and there is the idea. The question is how would each lamp look (on or off, and there are 10,000 lamps with 10,000 people who walked by) by the time all 10,000 people stopped by and did their duty? This isnt supposed to be easy, it was an interview question for a programming job. Please dont flood answers with "i dont know"
2006-10-30
15:50:12
·
9 answers
·
asked by
coolchess123
3
in
Mathematics