Every morning, Mike the security guard at CP high school opens all 1000 doors in the building. Let's assume the doors are numbered 1-1000. The next security guard closes all even numbered doors. The third security guard touches all doors that are multiples of 3. If a door is open, he'll close it and vice versa. The fourth guard changes the position of every fourth door (if it's open he'll close it etc.,) and the fifth guard changes the position of every fifth door and so on, until the 1000th guard changes only door 1000.

HOW MANY DOORS ARE LEFT OPEN IN THE END?

i think it will require pen and paper.. :P

ReplyDeleteso... alasyam param dharam!!

This comment has been removed by the author.

ReplyDelete1000-500+333-250+200...........

ReplyDeleteint values of the nummbers obtained when 1000 is divided by all the numbers from 1 to 1000 with addition and subtraction alternatively... din have time to do such a big calculation.. ny one wth answer?

This comment has been removed by the author.

ReplyDeleteOnly the doors numbers that are perfect squares will remain open. Doors 1,4,9,16...... will always remain open.

ReplyDeleteTry to figure out the reason (think number of divisors of a number).

This comment has been removed by the author.

DeleteYes , door numbers that are perfect squares will remain opened. For a number 'X',including 1 and X itself ,at each divisor place 'a'the door gets closed/opened if it is opened/closed in its previous multiplicative factor 'b' such that a*b=X.Since the number of divisors for a perfect square is odd (open,close, open ) and for others the number of divisors is even (open close)hence doors with perfect squares will remain opened.

ReplyDelete30 open and 970 closed... cos there are 30 perfect squares (each perfect square has even factors excluding 1).. so these doors will be opened-closed an even number of times leading to no change.. all others will be changed since will be opened-closed odd number of times

ReplyDelete31x31 = 961

ReplyDeleteTherefore the answer is 31 and 969

31 perfect squares are there btwn 1 and 1000

ReplyDelete31 wll be open

all others wll be closd

This comment has been removed by the author.

ReplyDeleteIn the end, only the doors of the perfect squares remain open... 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 729 784 841 900 961

ReplyDeleteinsane!!!!

Here is some R code I just wrote:

b <- rep(TRUE, 1000)

for (p in 2:1000){

for(i in 1:length(b)){ # 'i' is for index

if (i%%p == 0) {

b[i] <- !b[i]} #then open door

}

}

b

which(b== TRUE, arr.ind=TRUE)

Very nice and clean code! I was expecting many more lines!

ReplyDeletenicely explained this puzzle video solution

ReplyDeletehttps://www.youtube.com/watch?v=cQhaaictt7M

nicely explained this puzzle video solution

ReplyDeletehttps://www.youtube.com/watch?v=cQhaaictt7M