Brain Teasers Optical Illusions Puzzle Hunts Codes & Ciphers Mechanical Puzzles
Personal Links
Browse Teasers
Search Teasers

100 Closed Lockers

Math brain teasers require computations to solve.


Puzzle ID:#7824
Fun:*** (2.83)
Difficulty:*** (2.85)
Submitted By:warrior***
Corrected By:sweetime




Suppose you're in a hallway lined with 100 closed lockers.
You begin by opening every locker. Then you close every second locker. Then you go to every third locker and open it (if it's closed) or close it (if it's open). Let's call this action toggling a locker. Continue toggling every nth locker on pass number n. After 100 passes, where you toggle only locker #100, how many lockers are open?

Open Calculator


Answer: 10 lockers are left open:
Lockers #1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
Each of these numbers are perfect squares. This problem is based on the factors of the locker number.
Each locker is toggled by each factor; for example, locker #40 is toggled on pass number 1, 2, 4, 5, 8, 10, 20, and 40. That's eight toggles: open-closed-open-closed-open-closed-open-closed.

The only way a locker could be left open is if it is toggled an odd number of times. The only numbers with an odd number of factors are the perfect
squares. Thus, the perfect squares are left open.

For example, locker #25 is toggled on pass number 1, 5, and 25 (three toggles): open-closed-open.


What Next?


See another brain teaser just like this one...

Or, just get a random brain teaser

If you become a registered user you can vote on this brain teaser, keep track of
which ones you have seen, and even make your own.



Oct 29, 2002

Maybe this should of gone in math but i liked it
Dec 12, 2002

i was thinking all of the primes but you closed all of them in the beghinning. oops.
Jun 21, 2003

WOW! I would have had to write it all out and everything...I'm just not that smart.
Aug 08, 2003

Great puzzle but surely belongs in the Mathematics category?
Jun 27, 2004

Excellent. I worked through the first 20 lockers, noticed that only the perfect squares were open, and realized that those were the only numbers with an odd quantity of factors. I need to eat more fish.
Dec 27, 2004

Very Good. It took me a long time to get that one.
(user deleted)
Dec 27, 2004

that made my brain hurt
Dec 27, 2004

Wow!! I finally got it but now I think I have a headache!!! Great teaser! I agree, though, it should be in the math category!!
Dec 27, 2004

this teaser was really hard. it got me goooooood.
Dec 27, 2004

The teaser sounded fun at first till i remebered the same exact problem my sophmore son brought home for algebra homework
Dec 27, 2004

That really made you think!! alot!! but it was still kewl!
Dec 27, 2004

This was an interesting problem although i do agree that it belongs in the math category.
Dec 27, 2004

interesting..... unfortunetly I didn't even bother to figure it out!!!!1 How classic of me!!!
Dec 28, 2004

very interesting! and a lot of fun
Dec 28, 2004

took to long to figure out the answer.... i didnt work it out should go in the math
Feb 22, 2005

this is a really great teaser because if you dont have any patients then you will not sit down and work this out. and it really makes you think! i liked it and i got it!!!
Feb 08, 2006

I love this teaser. Only problem is, I did this as homework for my math class and it was up to 1,00 lockers...
Feb 08, 2006

Whoops. 1000 lockers
Jun 22, 2006

LOVE THIS! This will be the first entry into my 'favorite teasers' list.

Easy to figure out when you look for the pattern.

Start with 1, then 2, then 3, then 4, then 5, etc.

You will see the pattern...
using the numbers:
4-1 = 3
9-4 = 5
16-9 = 7
25-16 = 9
36-25 = 11

The pattern, therefore, increases steadily by 2...uncovering the squares
Dec 18, 2006

Very hard, but extremely fun!
Aug 21, 2007

The result depends on what you mean by "every second" locker. I assumed this meant the first, the third, the fifth and so on. "Every third" means no. 1, no. 4, no. 7 and so on. In which case there are only 9 open after 100 passes, their numbers being n^2 + 1 (0
Jan 03, 2009

Very easy, but also elegant teaser. The odd number of factors was obvious, and after thinking a moment it was clear that to have an odd number of factors that one of the numbers must be multiplied by itself. Good job!
(user deleted)
May 10, 2009

I am unable to understand the logic that why would ALL other numbers have even factors only. I must admit I tried several numbers and came up with even numbers only, but am unable to figure out a logic behind that.
Sep 28, 2011

please help me to understand what this line means,
" Continue toggling every nth locker on pass number n. After 100 passes, where you toggle only locker #100,"

so that I can continue working on this one!
Oct 12, 2012

Love this brain teaser - one of my favorites to ask during interviews just to see how people think.

Found another great answer here too:

Back to Top

Online Now
7 users and 545 guests

Users In Chat
Follow Braingle!
Fold 'N Fly Paper Airplanes
Easy to follow folding instructions and videos.
Copyright © 1999-2017 | FAQ | Widgets | Links | Green | Subscribe | Contact | Privacy | Conditions | Advertise | Braingle Time: 7:23 pm
Sign In Create a free account