Results 1 to 2 of 2

Thread: Lockers...

  1. #1
    Expert Member
    Join Date
    Jun 2006


    There are 1000 lockers in a high school with 1000 students. The
    problem begins with the first student opening all 1000 lockers; next
    the second student closes lockers 2,4,6,8,10 and so on to locker 1000;
    the third student changes the state (opens lockers closed, closes
    lockers open) on lockers 3,6,9,12,15 and so on; the fourth student
    changes the state of lockers 4,8,12,16 and so on. This goes on until
    every student has had a turn.

    How many lockers will be open at the end? What is the formula?

  2. #2
    Contributing Member
    Join Date
    Sep 2006

    Re: Lockers...

    For example the 18th locker will be visited by those students whose numbers are factors of 18. i.e. by numbers 1,2,3,6,9,18. This is 6 students (an even number) and this means the locker will in turn be
    open/closed/open/closed/open/closed. Now all numbers with an even number of factors will end up closed. And all numbers EXCEPT PERFECT SQUARES have an even number of factors if we include 1 and the number itself. For a perfect square, say 16, we have factors 1,2,4,8,16, an odd number, and the lockers would be open/closed/open/closed/open.

    So perfect squares always have an odd number of factors, and all other numbers have an even number of factors.

    Lockers that are open are 1, 4, 9, 16, 25, 36, .....

    So total number of lockers that are open is 31.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.