There is a room with 1000 light switches, numbered 1, 2, 3,
4, ... 1000, all turned off.
Outside the room there are 1000 men, numbered man1, man2,
...man 1000
In order, each man walks into the room and changes the
position of each switch that is a multiple of his number.
That is: man1 flips every switch
man2 flips switches 2, 4, 6, 8 ....1000
man3 flips switches 3, 6, 9, ..... 999
.....
Man 1000 flips switch 1000
After all 1000 men are done, how many switches are on?
Answer Posted / rams
The answer is 31. All the perfect squares are on. ie 1,4,9,16,25,36....961(31*31).
Here is the logic.
The first person switches on every thing.
The multiple factors come in pairs, so the changes done by multiple factors has no effect. So all the Switches are on.
The switches are turned off by the person with same number.
The square root switches on the lights for the perfect squares.
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
hai i am mca 2009 fresher.please tell me which certification helps me to get an IT job faster which institute is good in hyderabad.please mail me to prasanna.1856@rediff.com
What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?
THE CHANNEL IN DATA COMMUNICATION CAN BE?
how pseudo column works?
what is the purpose of checked Menu options
how to generate dsnless connectivity in j2ee
1. How many jobs can we write in a single file? 2. How many maximum members can exist in a single partition data set(pds) in jcl?
how to data grid use in data bind?
any drawback are there in mantis?
Difference between HTML and DHTML?
Explain what is OOPS and its concepts?
how to convert hashmap to arraylist with iteration
WS-NUM PIC S9(05)V(02) SIGN TRAILING SEPARATE MOVE '0050000+' TO WS-NUM The value stored is 00500,00+ MOVE '0050000-' TO WS-NUM Then what is the value will be stored in WS-NUM? Am getting '-00500,00'.....>>> What should I declare to WS-NUM so that I can get correct values for both + & - signs.
What are events in smartforms?
Why did you ever become involved in QA/testing?