### Classic Locker Problem With A Twist, March 9-13, 1998

NOTE: This problem was a Middle School Problem of the Week and is offered here because it is no longer part of our Problem of the Week archive.

One hundred students are assigned lockers 1 through 100. The student assigned to locker number 1 opens all 100 lockers. the student assigned to locker number 2 then closes all lockers whose numbers are multiples of 2. The student assigned to locker number 3 changes the status of all lockers whose numbers are multiples of 3 (e.g. locker number 3, which is open gets closed, locker number 6, which is closed, gets opened.) The student assigned to locker number 4 changes the status of all lockers whose numbers are multiples of 4, and so on for all 100 students.

• Which lockers will be left opened?

• Which locker was switched the most times?

• How many lockers, and which ones, were touched exactly twice?

I am delighted with the number of correct responses and with the variety of ways the students were able to find the solutions.

The next time I do a problem like this, it won't be a multi-question problem since partial credit is not really an option. I would save the more difficult question for the bonus.

The level of difficulty appeared to be high based on the number students who responded (compared to the previous week's POW). However, there are students who were up to the challenge.

I really enjoyed reading the responses and loved some of the more personal kind of statements that the students made as they were trying to explain their solution.

### Highlighted Solutions

```
From:   Brett Wortzman
Email
School: O'Donnell Middle School, Stoughton, MA

open:
1,4,9,16,25,36,49,64,81,100

twice:
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,
83,89,91,97

most:
72,96

METHOD:

From previous experience, I knew that this problem was based on the
factors of each number. Each locker would be switched by each of its
factors.

The only way a locker could be left open is if it was switched 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.

The only numbers that have only two factors are the primes.
Therefore, the prime numbered lockers were touched twice.

After factoring most of the locker numbers, I found 72 and 96
each had 12 factors. I was unable to find a number with more factors
than this, so these two numbers would be touched the most, twelve
times.

```

```
From:   Zack Jenny
Email
School: Highland Middle School, Highland, Illinois

The lockers that will be left open are the lockers numbered
1,4,9,16,25,36,49,64,81. (hint:all lockers are perfect square.
ex:1 square is 1, 2 square is 4....

The lockers that were switched the most were: lockers 60,42,84,
90,96. they were switched 12 times each.

the lockers that were touched exactly twice were lockers numbered
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,
89.97

They are all prime numbers.

```

```
From:   Mike Bockus
Email
School: John Shero Jr. High, Wilburton, OK

First I wrote down the first 30 positive integers and simulated the
experiment for 30 students. I discovered the the lockers left open
at the end of the experiment had perfect squares for numbers. So the
answer to question 1 is: locker numbers 1,4,9,16,25,36,49,64,81,100
will be left open.

Next I kept a check on how many times each locker was opened and
closed and found that the ones with prime numbers for their number
are switched only twice. This makes sense because a prime number has
only two factors, itself and 1. So the answer to question 3 is all
locker numbers that are a prime number are switched twice.

The second question was the most difficult for me. I decided to look
for a number that had a large number of factors. I came up with two
lockers, 72 and 84 -  both have 12 factors, making them the lockers
that are switched most often.

```

```
From:   Alison Wright
Email
School: Nichols Middle School, Mrs. O'Keefe's math class

The 1st question: the lockers that will be left open are the ones
that have an odd number of factors. Since most factors come in pairs
(8 is 8&1, 4&2, etc.). all of the numbers that have an odd number of
factors will be left opened.  The only numbers that have an odd
factor amount are the squares. Hence, the lockers that are left open
are 1,4,9,16,25,36,49,64,81,100.

The 2nd question: For this one I mostly guessed and checked. I figured
that the number would be even and divisible by three and 4. Then it
would be by a lot of things. 84 and 96 both had 12 factors each.

The 3rd question: The lockers that will be touched exactly twice are
the prime ones.  They are touched by number 1 and themselves, and that
is all.

```

```
From:   Jay Gill
Email
School: Nichols Middle School, Buffalo, NY

First, I realized it would be impractical to try to simualate all
100 steps. So, I tried to find a pattern.

Each student switches all the lockers which are multiples of his
number. So, each locker is switched by each student who has a
number which is factor of the locker's number.

Example: locker 36 is switched by students 1, 2, 3, 4, 6, 9, 12, 18,
and 36. (All the factors of 36.) If it is switched an even number
of times, it winds up closed. If it is switched an odd number of
times, it ends up open. Each locker is hit at least once. (By
student number one.) So, locker 36 ends up open.

First question: Which lockers end up open?  This means, which numbers
have an odd number of factors?

Well, with most numbers, factors come in pairs. (1 and 36, 2 and 18,
3 and 12, 4 and 9, etc.) So most lockers end up closed. But sometimes
a factor pair is two of the same number (6 and 6). Then the number
only gets counted once, so this creates an odd number of factors.
This only occurs in the square numbers.

There are ten square numbers from 1 to 100. (1, 4, 9, 16, 25, 36,
49, 64, 81, and 100)

Second question: Which locker was switched the most times?  This
means, which number has the most factors?

To do this, I started by experimenting with large numbers to see
how many factors they have. I began to notice that, as a general
rule, the more prime factors a number has, the more factors it has.
I tried numbers which were made by multiplying togther 2's, 3's,
5's, and 7's. I found five numbers with twelve factors: 60, 72, 84,
90, and 96. But I didn't find any with more than that. There can't
be a number with 13, because that would have to be a square number,
the highest of which is 100, which only has 9. I also showed that
there can't be any with more than that.

In order for a number to have 14 factors, it must have 7 that are
below its square root, so it must have 7 factors from 1 to 9, or 6
from 2 to 9.
It must obvously be a multiple of 2, or 2, 4, 6, and 8 would not be
factors.
It must be a multiple of 3 and 6 for the same reason.
It must have 3 factors out of 4, 5, 7, 8, and 9.
It cannot have 7, because 2 * 8 * 7 = 112, which is over 100.
If it does not have 9, then it must have 8, 3, and 5, which makes 120.
If it does not have 8, then it must have 9, 4, 5, which makes 180.
If it does not have 4, then it can't have 8.
So, it must have: 1, 2, 3, 4, 6, 8, 9, and not 7 or 5.
But, the only number from 1 to 100 that has all the factors is 72,
which is 8 * 9. Its square root is lass than 9, and it only has
12 factors.
SO, no number from 1 - 100 has more than 12 factors, but five have
exactly 12.

The third question is much easier.
Which lockers were touched exactly twice?
Which numbers have exactly two factors?
By definition, a number with only two factors is a prime number!
All prime numbers and only prime numbers have two factors.

1. The lockers numbered 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100
were left open.

2. The lockers numbered 60, 72, 84, 90, and 96 were "tied" for
having been switched the most number of times.

3. 25 lockers were touched exactly twice. They were: 2, 3, 5, 7,
11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, and 97.

```

```
From:   Rebecca and Liidia and Alex and Tess
Email
School: National Cathedral School, Washington DC

When we first read the problem we thought there would have to be
a more mathematical way to solve this problem than drawing out
the 100 lockers, so we looked at the problem more closely.

The status of a locker is changed so many times according to its
number of factors. When the bottom of the problem asked,
"How many lockers, and which ones, were touched exactly twice,
we figured out that these locker's numbers would have to be prime.
The lockers 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,
71,73,79,83,89, and 97 will have been touched exactly twice
because these are the prime numbers up to 100. There are 25 of
these numbers.

Then we looked at the question that asked "Which lockers will be
left open?" We noticed and observed as we figured this out that
if person number one opens all the lockers, then when the next
person and all the even numbers of people who touch it will
close the locker. The only lockers that will stay open are the
lockers that will be touched an odd number of times, or have
an odd number of factors which are square numbers. The square
numbers up to 100 are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.

Then there was the last question, "Which locker was switched the
most times?" This would have to be the locker number with most
factors. We found three, 60, 72, and 96. Each of these numbers
have exactly 12 factors.

Each answer we described above is our conclusion.

```

```
From:   Neil Bress
Email   nbress @ aol.com
School: Morgan Village Middle School, Camden, NJ

Two different groups of students worked on this problem.

First, I thought it would be an excellent introduction to the concept
of spreadsheets on the computer, so I had our Math/Science Club meet
in the computer room this week. I presented the problem, and gave them
5 days not only to come up with a solution, but to be able to display
their plan of attack.

Setting up the spreadsheet was fairly easy. After the initial cell had
been labeled "STUDENTS," the spreadsheet was filled down with numbers
from 1 to 100 in the first column (100 students), and filled right with
the numbers from 1 to 100 (lockers 1 to 100) in the first row.

Next, the second row was filled across with an "O" to represent OPEN.
Then, taking turns, each student completed the subsequent row with
a "C" for CLOSE or an "O" for OPEN, as per the directions of the
problem. Since we do not have 25 students in the Club, and since
everyone wanted to participate, they just took turns.

They ended up printing out the document in 8 pages, and were able to
display it very creatively on the bulletin board outside the Computer
Lab.

My 6th Grade students were not involved in this week's EWT
examinations, so I decided a little "hands on approach" would work.
Including myself and my instructional assistant, we had 25 people in
attendance on Wednesday, so I borrowed a locker key from our head of
maintenance and, as the first participant, OPENED 100 lockers. I had
made up a set of instruction cards beforehand, and each student
selected a card and followed the instructions.  Except for some
complaints about the noise (lockers slamming), it was a very
successful activity.

As for the results:

The lockers left opened were 1, 4, 9, 16, 25, 36, 49, 64, 81 and
100 (Congrats to HERMA in the Math Club and WILLIAM in Grade 6, who
were the first students to correctly identify the PERFECT SQUARES
of the numbers 1 - 10).

The lockers switched the most times were 60, 72, 84, 90 and 96.

There were a total of 25 lockers touched exactly twice (OPEN and CLOSE
ONLY): 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89 and 97  (Congrats to Nasir and Brandon in
the Math Club, who were the first students to correctly identify the
PRIME NUMBERS less than 100.)

Thanks for helping to liven up EWT Week at Morgan Village.

```

```
From:   Derek Hidey
Email
School: Washington Middle, Cumberland, MD

1. (a) Lockers left open were:  1, 4, 9, 16, 25, 36, 49, 64, 80,
81 and 100.

(b) Lockers 60, 72, 84, 90 and 96 were switched the most times
(each was switched 12 times).

(c) Twenty-five (25) lockers were touched exactly twice.  They
were:  2, 3, 5, 7, 11, 13, 17, 19, 23 29, 31, 37, 41, 43,
47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97.

2. I found this problem easy but time-consuming.  First, I
numbered a sheet of paper from 1 to 100 and started to change
the status of the lockers. Beginning with locker 1, I opened
all lockers through 100 (I indicated an open locker by placing
a zero next to the locker number). Then, beginning with locker
2, I changed the status of all lockers that are multiples of 2
(I indicated a closed locker by placing a / through the
zero). I repeated this procedure through locker 50.

I then changed the status of lockers 51 through 100 because each
number would be a multiple of 1 times itself.

Once the chart was completed I began to answer the questions.
My answer for which lockers were left open is:

1, 4, 9, 16, 25, 36, 49, 64, 80, 81 and 100.

Then, for the answer to which lockers were switched the most
times, I found that lockers 60, 72, 84, 90 and 96 were each
switched 12 times. Finally, there were 25 lockers that were
only switched twice. These lockers are:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
59, 61, 67, 71, 73, 79, 83, 89 and 97.

```

```
From:   Kenny Siggs
Email
School: PLDMS, Ft. Myers, FL

I found that lockers 1,2,9,16,25,36,49,64,81,100 will be left open.
Lockers 60,72,84,90,96 were switched the most times. 25 lockers were
touched exactly twice.... they were lockers 2,3,5,7,11,13,17,19,23,
29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97.

I found all this by writing the numbers 1 - 100 on 2 pieces of graph
paper. Then I used + and - signs for if the locker was open or not.
I marked each number when it was a multiple of another number.

```

```
From:   Aaron Tjoa
Email
School: Nichols Middle School, Amherst, NY

Lockers open - 1,4,9,16,25,36,49,64,81,100
Lockers switched the most times - 90,96,84,72,60
Lockers touched twice - 2, 3,5,7,11,13,17,19,23,29,31,37,41,43,
47,53,59,61,67,71,73,79,83,89,97

I knew that all the lockers touched an odd number of times were open.
Since perfect squares are the only numbers with an odd number of
factors, the lockers that were perfect squares were the ones that
were open.

I knew that all the lockers touched twice had only two factors.
Since prime numbers are the only numbers with only 2 factors, they
were the ones that were touched twice.

To find the locker that was touched the most, I made a graph with
all the numbers from 1-100. I worked out the first 20 students and
found the numbers 60,72,84,90, and 96 to have the most factors.
Since I am a mathematician and lazy by trait, I didn't finish the
graph. I found the factors for those five numbers and found them to
be exactly equal.

```

```
From:   Annie Roth
Email
School: Frenchtown Junior High, Frenchtown, Montana

To find the answer to the locker problem, I used several facts.

In the numbers one through one hundred, there are 25 prime numbers.
These would be the numbers that were only touched twice because
they only have two factors... 1 and themselves. So the lockers that
will be touched twice are the 25 prime numbers between 1 and 100:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
67, 71, 73, 79, 83, 89, and 97.

As for the ones that will be left open, this is how I figured those out.

In order to be a locker that is left open, the locker would have to be
touched an odd number of times. All numbers have an equal number of
factors because factors come in pairs: x's pair is y because x times y
= the number you are finding the factors of. This is true except for
perfect squares because in perfect squares a number is multiplied by
itself, and only counted once.  x's pair is x, so x is the pair of
factors, only one number. This would make all the perfect squares, and
only the perfect squares, have an odd number of factors. They would be
left open. The perfect squares from 1 to 100: 1, 4, 9, 16, 25, 36, 49,
64, 81, 100.

To find out which locker would be touched the most:

I counted from 1 to 100 and all the numbers that I knew have many
factors I wrote down. The numbers I wrote down were: 24, 36, 48, 60,
72, 80, 84, 90, and 96. Then I wrote out a list of each number's factors.
My lists looked like this:

24: 1,2,3,4,6,8,12,24.....8
36: 1,2,3,4,6,9,12,18,36.....9
48: 1,2,3,4,6,8,12,16,24,48.....10
60: 1,2,3,4,5,6,10,12,15,20,30,60.....12
72: 1,2,3,4,6,8,9,12,18,24,36,72.....12
80: 1,2,4,5,8,10,16,20,40,80.....10
84: 1,2,3,4,6,7,12,14,21,28,42,84.....12
90: 1,2,3,5,6,9,10,15,18,30,45,90.....12
96: 1,2,3,4,6,8,12,16,24,32,48,96.....12

The locker numbers with the most factors would be touched the most.
There are several numbers with the highest number of factors. The
highest number of times a locker would be touched would be 12.
Locker numbers: 60, 72, 84, 90, and 96.

```