## The Locker Puzzle

A forum for good logic/math puzzles.

Moderators: jestingrabbit, Moderators General, Prelates

rlo
Posts: 92
Joined: Wed Oct 04, 2006 11:43 am UTC

### The Locker Puzzle

A school has a hallway with 100 lockers. All the lockers are closed.

Student one walks down the hallway and opens every locker. Student two walks down the hallway and closes every second locker, starting at locker two. Student three walks down the hallway and changes the state of every third locker, starting at locker three.

In general, student n changes the state of every n-th locker.

After 100 students have passed through the hallway, which lockers are left open?

(This is my favorite puzzle, mostly because the answer is so unexpected!)

TheReverend
Posts: 30
Joined: Wed Aug 30, 2006 8:08 pm UTC
Location: most likely at work
Contact:
I cheated and wrote a program to do it...I see the pattern but I'm struggling with why the pattern is what it is.

aaronspook
Posts: 20
Joined: Thu Jul 20, 2006 9:55 pm UTC
I think I have the answer, and it seems pretty easy to arrive at if you just think about the problem in terms of factors.

jgf
Posts: 33
Joined: Tue Sep 26, 2006 9:04 pm UTC
This is one of my favorite puzzles. Must have first heard it a dozen years ago, and it's getting to the point where I hear "A 1000 lockers/lightbulbs are in a row..." and the answer springs to my head.

Monox D. I-Fly
Posts: 74
Joined: Sat Mar 26, 2016 1:49 am UTC
Location: Indonesia

### Re: The Locker Puzzle

Spoiler:
The lockers with quadratic numbers, right? Because they are the only ones which have odd numbers of factors thus they are left open.

If you know your Forum History, and you clearly don't, you would know that in the time before spoilers, we had puzzle threads and solution threads, and this was solved a long time ago. -jr
Finally found one comic mentioning a Trading Card Game:
https://xkcd.com/696/

Sandor
Posts: 173
Joined: Sat Feb 13, 2010 8:25 am UTC

### Re: The Locker Puzzle

Spoiler:

More commonly called "square numbers".

### Who is online

Users browsing this forum: No registered users and 4 guests