# Help on Algebra Problem

I need help on this problem that 8/9 Grade Math Teacher Assigned me (I'm in 7th Grade). Here's the problem -

Today is Latisha's birthday. Fifty friends have thrown her a surprise party. Before the party, her friends got together and decided to secretly hide several presents in 50 separate boxes numbered 1 to 50.

Latisha is now about to open her gifts, which are arranged in a row in order. Her friends explain that if she follows the instructions below, she will discover which boxes hold a gift.

Latisha wants you to help her figure out which boxes hold presents without actually carrying out their instructions.

Their Instructions:

First, she should go down the line and open every box.

Then, starting with box #2, she should close every other box as she goes down the row.

Starting with box #3, she should change every third box (she opens the box if it is closed and closes it if the box is open)

Starting with box #4, she should change every fourth box.

Starting with box #5, she should change every fifth box.

Continue this process through box #50.

Basically, the boxes at the end that are open are the ones with presents in them. I think that you would have to use a factorial-related-strategy, but I'm not sure. Can anyone help?

• Can you share any ideas you have, or considered, about how to approach this problem? Commented Apr 14, 2017 at 23:34
• @amWhy I have tried lining up all the numbers, and marking an 'X' over closed presents and an 'O' open presents. I know that all the prime numbers are closed. Basically, the way that I've been doing it is finding out how many factors each number has, and if a number has an odd number of factors, it is closed. If a number has an even number of factors, it is open. Hope that's good enough. Commented Apr 14, 2017 at 23:38
• That's great input, @Nathan ! It's certainly good enough! Thanks for adding that! Commented Apr 14, 2017 at 23:45

This is a variation of the Locker Problem. Imagine there are only 10 boxes. If you start with them all open (and if she opens them all, wouldn't she be able to see which ones have gifts?), and close all the even-numbered ones, the boxes that are open are the ones that are not divisible by 2. Now you close boxes 3 and 9 but open box 6 (the multiples of 3). Then you close or open the multiples of 4, and the multiples of 5, etc. etc. The only boxes left are the ones that have an odd number of factors. For example, 10 is divisible by 1, 2, 5, and 10, so it would be closed. However, 9 is divisibly by 1, 3, and 9, so it is open.

I see from a comment made while writing this, that you say

if a number has an odd number of factors, it is closed. If a number has an even number of factors, it is open.

It is actually the opposite, since you must count 1 as a factor.

I hope you can solve this from here, but the only numbers with an odd number of factors are:

perfect squares

• So are the only boxes open the ones that are perfect squares? Commented Apr 14, 2017 at 23:45
• @NathanChan Yes. Don't forget that 1 is a perfect square. It seems that Latisha got 7 gifts, which is a pathetic turnout for 50 friends! Commented Apr 14, 2017 at 23:56

A box is flipped once for every divisor its number has and it starts from closed, so it is closed if it has an even number of divisors and open if it has an odd number of divisors.

So this is progress, but it would be good to simplify the answer further. So we need to figure out how to tell whether a number has an even or odd number of divisors other than by counting them. The key here is to note that usually, divisors come in pairs. Say you're look for divisors of $10$. Then you have $1$ and $10,$ and $2$ and $5$... two pairs of divisors for a total of 4. So it seems like this would imply that usually there are an even number of divisors. But there is one situation where the above logic fails and you can have an odd number of divisors.