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
Explain what is OOPS and its concepts?
in teradata level primary in table level allows duplicates why?
Hi guyes, I have cleared 2 technical rounds with cts for liferay and java techonologies, i have client round next week, please tell me how to prepare for this what questions i should be ready to face?
kindly send interview materials
Code for display the images from drive using vb 6.0?
Define distributed queries. can you explain me as soon as possible
What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe
when a query is made on Logical file in DB2/400, will the records satisfying select/omit criterion be fetched from all members of physical file or only the member with same name as physical file?
1) How can u create the table?
How to get the index of the clicked field in reports in ABAP?
Iam using Microsoft Visual Studio to create a system for mobile store I want to know how to calculate mobile price that the customer buy and how to reduce quantity from the data base that we have for mobile .And also how to calculate revnue for each mobile and revnue for the total mobile
Why did you ever become involved in QA/testing?
what is session state?
how to hide prompts
I HAVE DONE TESTING TOOLS COURSE,NOW I AM FRESHER,I AM NOT GETTING ANY CALLS,I WANT TO DO THE PROJECT ,WHERE I HAVE TO MEET TO DO THE PROJECT,I AM GOING WITH FAKE EXPERIENCE,SO WHAT I HAVE TO DO.