jr@bbnccv.UUCP (John Robinson) (04/22/85)
I'm new to this newsgroup. Hope this isn't a repeat: Lining the corridor of a school are 1000 lockers. The first student to arrive at school one morning decides to open the doors to all 1000 lockers. The second student to arrive that morning decides to go down the hall and close the door of every second locker (that is, lockers 2, 4, 6, etc.). The third student to arrive that morning goes down the hall and changes the status of every third locker (that is, if the door is open, she will shut it and if the door is closed, she will open it). As the students arrive, this process continues, with the fourth student affecting lockers 4, 8, 12, etc., and the fifth student changing the status of lockers 5, 10, etc., until the 1000th student goes all the way down the hall to change the status of the 1000th locker. Now, after all this has been done, which lockers are open, which are closed, and why? Enjoy, /jr
tallman@dspo.UUCP (04/23/85)
> Lining the corridor of a school are 1000 lockers. The first student > to arrive at school one morning decides to open the doors to all 1000 > lockers. The second student to arrive that morning decides to go down > the hall and close the door of every second locker... > As the students arrive, this process continues...until the 1000th > student... Now, after all this has been done, which lockers are open, > which are closed, and why? All lockers whose numbers are perfect squares will be open (1,4,9...) and all others will be closed. The reasoning is as follows - A locker will be closed if it has an even number of divisors including itself and 1. It will be open if it has an odd number. Suppose a number n has a divisor k. Then it also has a divisor n/k. So all divisors of n pair up, unless there exists k = n/k, i.e. n is the perfect square k*k. -- C. David Tallman - dspo!tallman@LANL or {ucbvax!unmvax,ihnp4}!lanl!dspo!tallman Los Alamos National Laboratory - E-10/Data Systems Los Alamos, New Mexico - (505) 667-8495