posted by
mohit_at_codepad
on Jul 28
Simple reasoning can tell that no matter how many students are there, only gate number 1, 4, 9, 16... are open and rest all are closed.
reply
posted by
mohit_at_codepad
on Jul 28
If you list all the multiples of a number n they are
n is divided by 1, k1, k2...km, n/km, ... n/k2, n/k1, n/1 (where km < sqrt(n), If n is not a perfect square)
So the number of multiples are even which means the door is not toggled
n is divided by 1, k1, k2...km, ... n/k2, n/k1, n/1 (where km = sqrt(n), if n is perfect square. In this case km = n/km so it has no pair causing odd number of terms and thus door is toggled)
reply