There are N closed lockers numbered 1,2,...., N, each assigned to a different person.
The first of these N persons opens all lockers.
The second person goes to every second locker and closes them.
Then, the third person goes and alters the state of every third locker -- that is, opens the locker if closed, or closes it if open.
The fourth person alters the state of every fourth locker, and so on, until the last (Nth) person alters the state of just the Nth locker.

At the conclusion of this process, it is observed that the total number of closed lockers is precisely sixty-eight (68) times that of the total number of open lockers, with the total number of open lockers being a prime number.

Determine the value of N.
How many lockers end up open?




Solution to the Problem:


The total number of lockers (N) is 4623.
The total number of closed lockers and open lockers after completion of the said process will be 4556 and 67 respectively.

In a previous problem, the Lamp Problem, it was shown that the total number of open lockers (out of N lockers) will be equal to the number of perfect squares less than or equal to N.

Let P = Total number of open lockers and,
C = Total number of closed lockers.

Then, N will be greater than or equal to P^2 but less than (P +1)^ 2.
Accordingly: P^2 <= N < (P+1)^2 , and P^2 < P(P+1) < P(P+2)< (P+1)^2.

Since, by the problem, C is an exact multiple of P, it follows that N is an exact multiple of P and, accordingly:
N = P^2 or P(P+1) or P(P+2).
But, by the problem, C =68*P, so that, N = 69*P and, accordingly,
P =69 or, (P+1)= 69, or, (P+2) = 69, implying that P = 67, 68, 69.

Of the three available values of P, only 67 is a prime number and, consequently, P =67 giving C = 67*68 = 4556 and N = 67*69 = 4623.

Hence, the total number of lockers (N) is 4623.
The total number of closed lockers and open lockers after completion of the said process will be 4556 and 67 respectively.



Correctly solved by:

1. Davit Banana Istanbul, Turkey
2. Kelly Stubblefield Mobile, Alabama
3. Colin (Yowie) Bowey Beechworth, Victoria, Australia
4. Seth Cohen Concord, New Hampshire
5. Rob Miles Northbrook, Illinois