April 2019 - Math Problem

There are 10 closed lockers in a hallway and 10 students. The first student walks down the hallway and opens every locker. The second student walks down the hallway and closes every second locker. The third student walks down the hallway and closes every third open locker and opens every third closed locker. This process continues for all 10 students. How many lockers are open at the end?

Solution:

Three (3) lockers will be open at the end.

​Locker 1 ​Locker 2 ​Locker 3 ​Locker 4 ​Locker 5 ​Locker 6 ​Locker 7 ​Locker 8 ​Locker 9 ​Locker 10
​Student 0 ​Closed Closed​ ​Closed ​Closed ​Closed ​Closed ​Closed ​Closed ​Closed ​Closed
​Student 1 Open ​Open ​Open ​Open ​Open ​Open ​Open ​Open Open​ ​Open
​Student 2 Open​ ​Closed ​Open ​Closed ​Open ​Closed ​Open ​Closed ​Open ​Closed​
​Student 3 ​Open ​Closed ​Closed ​Closed ​Open ​Open ​Open ​Closed ​Closed ​Closed
​Student 4 ​Open Closed​ ​Closed ​Open ​Open ​Open ​Open ​Open ​Closed Closed​
​Student 5 ​Open ​Closed ​Closed ​Open ​Closed ​Open ​Open ​Open ​Closed ​Open
​Student 6 ​Open ​Closed ​Closed ​Open ​Closed ​Closed ​Open ​Open ​Closed ​Open
​Student 7 ​Open ​Closed ​Closed ​Open ​Closed ​Closed ​Closed ​Open ​Closed ​Open
​Student 8 ​Open ​Closed ​Closed ​Open ​Closed Closed​ Closed​ ​Closed ​Closed ​Open
​Student 9 ​Open ​Closed ​Closed ​Open ​Closed ​Closed ​Closed ​Closed ​Open ​Open
​Student 10 ​Open Closed​ ​Closed​ ​Open ​Closed ​Closed ​Closed ​Closed ​Open ​Closed

 

What if there were 16 lockers and 16 students at the start?  How many lockers would be open at the end?

What if there were 400 lockers and 400 students at the start?  How many lockers would be open at the end?

Department