School-Safe Puzzle Games

## School Lockers: Math Problem

Thanks to our friend from Brazil,  Ahsergio, for submitting! Down a school corridor, there are 30 lockers in a row. All lockers are initially closed. 30 students will pass along this corridor, and they will change the position of the locker doors (open if closed, close if open) according to this specific sequence:

• the 1st student changes the position of all doors (since they were all closed, he opens them all)
• the 2nd student only changes the position of doors numbered 2,4,6,8,10,…
• the 3rd student only changes the position of doors number 3,6,9,12,15,…
• the 4th student only change the position of doors number 4,8,12,16,20,…
• and so on, until the last student.

After the 30th student has passed, which locker doors will remain open?

If you can figure this out, feel free to enter your answer in the comment section below. Will unmask later on this week, thanks.

### 19 Comments to “School Lockers: Math Problem”

1. hex | PUZZLE MASTER | Profile

1 4 9 16 25 will remain open.
Only perfect squares have an odd number of divisors.

2. engjs1960 | Profile

The squares: 1, 4, 9, 16, 25.

3. engjs1960 | Profile

To elucidate, every number can be linked to a set of integer pairs (a(i),b(i)), such that a(i) * b(i) = the number, a(i) = 1, b(i) <= the number. Eg, 12 = ((1,12), (2,6), (3,4)) Each pair represents two visits to the locker, so a set of such pairs will leave the locker closed. The fly in the ointment is the pair where a(i) = b(i). If such a pair exists, it only counts as 1 visit to the locker, so for that number the locker will be left open. If a number can be expressed as a factor multiplied by itself, then it is a square. Hence, all the squares.

4. jamesbuc | Profile

Square numbered doors remain open (1,4,9,16 and 25).

You can determine which students will change the position of a given door by splitting the door number into its factors. Door 18 for example is changed by students 1 and 18, 2 and 9, 3 and 6. Factors occur in pairs so a number always has an even number of factors and so the position of each door can ordinarily be expected to be changed an even number of times, leaving it in its original position (i.e. closed).

However, for a square number two of its factors are equal (9=3×3, 16=4×4..), and so in this context there are effectively an odd number of factors since each student only passes through the corridor once. Square numbered doors therefore have their position changed an odd number of times and thus remain open.

5. suineg | PUZZLE MASTER | Profile

cool puzzle, one solution could be this:
there is a pattern 1 only is open once an no other touches again that locker, 1 has 1 factor, 2 is open and then close and has 2 factors so to know which lockerss remains open you have to see the factors of the numbered lockers, if is an odd number then is open if is an even number then is close:
1: 1 (1) open 16: 1,2,4,8,16 (5) open
2: 1,2 (2) close 17: 1,17 (2) close
3: 1,3 (2) close 18: 1,2,3,6,9,18 (6) close
4: 1,2,4 (3) open 19: 1,19 (2) close
5: 1,5 (2) open 20: 1,2,4,5,10,20 (6) close
6: 1,2,3,6 (4) close 21: 1,3,7,21 (4) close
7: 1,7 (2) close 22: 1,2,11,22 (4) close
8: 1,2,4,8 (4) close 23: 1,23 (2) close
9: 1,3,9 (3) open 24: 1,2,3,4,6,8,12,24 (8) close
10: 1,2,5,10 (4) close 25: 1,5,25 (3) open
11: 1,11 (2) close 26: 1,2,13,26 (4) close
12: 1,2,3,4,6,12 (6)close 27: 1,3,9,27 (4) close
13: 1,13 (2) close 28: 1,2,4,7,14,28 (6) close
14: 1,2,7,14 (4) close 29: 1,29 (2) close
15: 1,3,5,15 (4) close 30: 1,2,3,5,6,10,15,30 (8) close

So the 1,4,5,9,16 and 25 are open.

6. Shofnite | Profile

My idea for this one…
The # of door which has even number of divisors will remain closed, and the one with odd number of divisors will remain closed.
For example,
Door # 4 will remain open because divisors of 4 are – 1,2,4, so the number of divisors is – 3.
Door # 7 will remain closed because number of divisors of 7 are 2 (1,7).

This clearly shows that Prime Numbered Doors will remain closed.

Remaining Numbers –
4,6,8,9,10,12,14,15,16,18,20,21,22,24,25,26,27,28,30.

Out of them, only 4,9,16,25 have odd number of divisors.
So only door numbered 4,9,16 and 25 will remain open.
Oh and yes, #1 will remain open as well.

So,
Door # 1,4,9,16 and 25 will remain open.
So, 5 doors will remain open.

The answer looks promising enough, though I’m not too sure.

One thing I noticed, all the numbers I obtained above are perfect squares. A little bit of googling and I found out that –
“Only Squares have odd number of divisors”.

7. Migrated | Profile

Since there are 30 lockers and 30 students, all the lockers will be open after the first student. The first locker therefore will remain open. All the even numbers will be closed. When the third student comes around, the multiples of 3 will be changed and so on. We eventually find a pattern that all the square numbers will be remained open, so that is 1,4,9,16 and 25. This would work for any x number of lockers and x number of students.

8. joe | Profile

Well I did it the long way, on a spreadsheet methodically changing it every time (although I know there is a quicker mathematical method)

I ended up with OPEN for 1, 4, 9, 16, 25.

So an easy pregressive series, which I am sure others will explain better…
Nice test thoguh, thanks.

9. aaronlau | Profile

All the squares will be Open.
1, 4, 9, 16, 25.

Because prime numbers only once. Close
All other numbers with 2 different denominators will be past by twice, neutralizing the effect. Plus the number itself, a odd number of times. Close.
Left only the squared numbers that pass by an even number of times. Open.

10. Shawn | PUZZLE GRANDMASTER | Profile

Well, if I programmed Excel correctly, it looks like only 5 doors remain open.

The open doors are on lockers whose numbers are a perfect square,

1
4
9
16
25

11. Bobo The Bear | PUZZLE MASTER | Profile

Lockers 1, 4, 9, 16, and 25 will remain open.

The only way a locker will remain open is if it is affected by an odd number of students. This only happens for the lockers that represent the perfect squares. Here’s why:

Each locker is affected only by the students whose numbers are factors of the locker number. For example, locker #10 if affected by students 1, 2, 5, and 10. This is an even number of factors, and so locker #10 will end up being closed. Because factors come in pairs (1×10; 2×5), most numbers have an even number of factors, meaning that most lockers will end up being closed.

The perfect squares are different. They are the result of a number multiplied by itself, but that number doesn’t get counted twice when writing a list of factors. Look at locker #9, for example. The number 9 can be factored as 1×9 or 3×3, but the list of factors is just 1, 3, and 9. So locker #9 is only affected by three students, and remains open at the end.

12. saeedsafasaeed | Profile

One can draw a table with all of the multiples, (3 times table, 4 times table etc) and can count the number of times each number appears, if the number is odd then that means that that door is closed, if the number is even then that means that the door is open

13. Ahmed | Profile

This will be easy if you can figure out the perfect squares from 1 to 30 which are:
1-4-9-16-25
so, these are the lockers that remain open

14. Frankros | Profile

1,4,9,16 and 25

15. Mashplum | PUZZLE MASTER | Profile

1, 4, 9, 16, 25

All prime numbered doors will be opened by number 1 and closed by their own number. They will be otherwise untouched.

All composite numbers have pairs of factors (and therefore an even number of factors) except perfect squares (which have an odd number of factors.)

16. Henkie | Profile

door 1, 4, 9, 16 and 25 will be open after all students passed

17. ahsergio | Profile

Good that u guys enjoyed it =D

18. noncoolman | Profile

My school had to do this, but it was 150 lockers.
Try to find the answer for it.

I got 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, and 144 .

19. bunny | Profile

Now I get it, thank you! xD