There are 100 rooms in an hotel named as R 1 , R 2 , . . , R 1 0 0 . Also there are 100 men namely M 1 , M 2 , . . . , M 1 0 0 .
Initially all the rooms are locked. Now go by the passage
This process continues till the 100th man.
Find the number of doors which are open at the last.
Clarification
R n will open all the doors R m if m is a multiple of n, but the condition is the opened doors(by others) must be closed by him.
Not original, and original was not explained so well.
Can you generalize for n men and n room?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Each room will be open by the men who's has the number which is one of the room number factor. e.g room number 12 will be open/close by men numbers 1,2,3,4,6,12. Initially all rooms were closed, so if an odd number of men get to a room the room will be opened in the last status. But if an even number of men get to a room the room will remain closed. (O,C,O,C,O,C,.....) ......... now we know that no numbers has an odd factors but the perfect squares. So the rooms has a perfect square number will be open. How many perfect square less than or equal to 100? Answer is sqrt(100) = 10. So for any given number of room (n), the numbers of the opened room (m) will be m=(int(sqrt(n))..
Yeah, Some kind like that ..
I did like this...
Say that M n comes. Now he will 1st open/close R n , then R 2 n and so on.
Now M 1 opened all. So now if even number of times the work is done, the doors will be opened at last.
Take for example M 4 . Now M 4 will open/close the last time, after him no one will touch the 4th door. So His work matters.
Now initially 1st man opened all, So 4th room opened, then 2nd again closed it, Now 4th again opened it.
So if it has odd number of divisors (including 1 and 4 as seen by above example) hence it is open at the last.
Now we know number of divisors = ( a 1 + 1 ) ( a 2 + 1 ) . . . ( a n + 1 ) if a 1 , a 2 , . . a n are the powers of the prime factos.
So for d ( n ) = ( a 1 + 1 ) ( a 2 + 1 ) . . . ( a n + 1 ) to be odd, each of a 1 , a 2 , . . a n must be even which only comes if the number is perfect square.
So from 1 to 100, ( 1 , 2 2 , . . 1 0 2 are all perfect squares. So all these 10 rooms will be open after the process ends.
So how was my solution?
Problem Loading...
Note Loading...
Set Loading...
Say that M n comes. Now he will 1st open/close R n , then R 2 n and so on.
Now M 1 opened all. So now if even number of times the work is done, the doors will be opened at last.
Take for example M 4 . Now M 4 will open/close the last time, after him no one will touch the 4th door. So His work matters.
Now initially 1st man opened all, So 4th room opened, then 2nd again closed it, Now 4th again opened it.
So if it has odd number of divisors (including 1 and 4 as seen by above example) hence it is open at the last.
Now we know number of divisors = ( a 1 + 1 ) ( a 2 + 1 ) . . . ( a n + 1 ) if a 1 , a 2 , . . a n are the powers of the prime factos.
So for d ( n ) = ( a 1 + 1 ) ( a 2 + 1 ) . . . ( a n + 1 ) to be odd, each of a 1 , a 2 , . . a n must be even which only comes if the number is perfect square.
So from 1 to 100, 1 2 , 2 2 , . . 1 0 2 are all perfect squares.
So all these 10 rooms will be open after the process ends.