Brain Teasers
Brain Teasers Trivia Mentalrobics Games Community
Personal Links
Submit a Teaser
Your Favorites
Your Watchlist
Browse Teasers
All

Cryptography
Group
Language
Letter-Equations
Logic
Logic-Grid
Math
Mystery
Optical-Illusions
Other
Probability
Rebus
Riddle
Science
Series
Situation
Trick
Trivia

Random
Daily Teasers
Search Teasers

Advanced Search
Add to Google Add to del.icio.us

More ways to get Braingle...

100 Closed Lockers

Math brain teasers require computations to solve.

 

Puzzle ID:#7824
Fun:*** (2.83)
Difficulty:*** (2.87)
Category:Math
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

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.

Hide




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.

 



Comments

dragon6786
Oct 29, 2002

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

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

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

Great puzzle but surely belongs in the Mathematics category?
cnmne*us*
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.
knbrain**
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
besbball917**
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!!
joeschmmoo
Dec 27, 2004

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

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

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

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

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

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

took to long to figure out the answer.... i didnt work it out should go in the math
brandynicole89*
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!!!
thepianistalex*us*
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...
thepianistalex*us*
Feb 08, 2006

Whoops. 1000 lockers
Smudgeza*
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
eyenowhourus*
Dec 18, 2006

Very hard, but extremely fun!
IldhundAen*
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
javaguru*us*
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.
fairygrrrl
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!
thanks
jporter892
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:


http://www.programmerinterview.com
/index.php/
puzzles/lockers-puzzle/



Back to Top
   



Users in Chat : dodger 

Online Now: 11 users and 497 guests

Copyright © 1999-2014 | Updates | FAQ | RSS | Widgets | Links | Green | Subscribe | Contact | Privacy | Conditions | Advertise

Custom Search





Sign In A Create a free account