Newon Middle School has a hall with 500 lockers, all of which are closed. Five hundred students start down the hall. The first student opens every locker. The second student closes all the lockers that are multiples of 2. The third student changes (closes an open locker or opens a closed locker) all multiples of 3. The fourth students changes all multiples of 4. And so on. After all students have finished with the lockers, how many will be closed and how many will be open?

A shortcut to finding the answer is explained here:

http://www.daniweb.com/blogs/entry387.html#

Only locker numbers that are perfect squares will be left open after all 500 students have done their thing. The series will be the perfect squares from 1, 4, 9 etc. up to 22^2 = 484.

Well, this sounds like the most epic game of "open and close" ever! Let's see if we can clown around with some math here.

When a student gets to a locker, it will be opened if it's closed or closed if it's open. That means each locker will be "toggled" as many times as it has factors.

For example, locker number 12 has factors 1, 2, 3, 4, 6, and 12. So it will be toggled 6 times: opened, closed, opened, closed, opened, and finally closed.

Now, if a number has an even number of factors, it will end up closed. That's because every time it gets toggled, it will end up in the same state it started. But if a number has an odd number of factors, it will end up open, because it will be toggled an odd number of times and end up in the opposite state.

So, for any given locker, the number of times it's toggled will be equal to the number of factors it has. But how many factors can a number have? Well, a prime number only has two factors (1 and itself), while a composite number has more. So, the only numbers that will have an odd number of factors are squares of prime numbers.

Now, let's think about this. How many square numbers are there between 1 and 500? Well, the square root of 500 is somewhere around 22, so there can be up to 22 squared numbers between 1 and 500.

So, there are 22 lockers that will remain open at the end, since they're the only ones with an odd number of factors. The remaining 500 - 22 = 478 lockers will end up closed.

There you have it! 478 closed lockers and 22 open lockers, courtesy of the "Clown-bot Math Circus"!

To solve this problem, we can follow the steps below:

1. Start with all the lockers closed.
2. Iterate through each student from 1 to 500.
3. For each student, iterate through all the lockers and change their open/close status based on if the locker number is a multiple of the student number.
4. At the end, count the number of open and closed lockers.

Let's calculate the number of open and closed lockers.

Step 1: Start with all the lockers closed.
- Number of closed lockers: 500
- Number of open lockers: 0

Step 2: Iterate through each student from 1 to 500.

Step 3: For each student, iterate through all the lockers and change their open/close status based on if the locker number is a multiple of the student number.

For the first student (1):
- All lockers are opened (500 lockers)

For the second student (2):
- Lockers 2, 4, 6, 8, ..., 500 are closed.
- Lockers 1, 3, 5, 7, ..., 499 are open.

For the third student (3):
- Lockers 3, 6, 9, 12, ..., 498, and 495, 492, 489, ..., 3 are opened.
- Lockers 1, 2, 4, 5, 7, 8, ..., 490, 491, 493, 494, 496, 497, 499, 500 are closed.

For the fourth student (4):
- Lockers 4, 8, 12, ..., 500 are opened.
- Lockers 1, 2, 3, 5, 6, 7, ..., 501, 502, ..., 499 are closed.

Following this pattern, we can see that even-numbered students will close lockers that are multiples of their number, and odd-numbered students will open lockers that are multiples of their number.

Step 4: Count the number of open and closed lockers.

Number of open lockers:
- Lockers with an odd number of factors will remain open
- To find the number of open lockers, we need to find the number of perfect squares less than or equal to 500.
- The number of such squares is the square root of the last perfect square (23^2 = 529) = 23.

Number of closed lockers: 500 - 23 = 477.

So, at the end, there will be 23 open lockers and 477 closed lockers.

To determine how many lockers will be closed and how many will be open after all students have finished, you can consider the pattern created by each student's actions.

Let's break down the problem step by step:

1. Initially, all the lockers are closed (since all the students haven't performed any actions yet).

2. The first student opens every locker. Now all 500 lockers are opened.

3. The second student (student 2) closes all the lockers that are multiples of 2. So, lockers 2, 4, 6, 8, and so on are closed. This means every second locker (i.e., even-numbered lockers) will be closed.

4. The third student (student 3) changes the status of lockers that are multiples of 3. Since the second student already closed all the lockers multiples of 2, student 3 will open all the lockers multiples of 3. This includes lockers 3, 6, 9, 12, and so on.

5. The fourth student (student 4) changes the status of lockers that are multiples of 4. However, since students 2 and 3 have already performed their actions, every multiple of 4 (which is already an even number and was closed by student 2) will be opened again.

6. This pattern continues for each student up until student 500, who will only affect locker 500.

To determine the final status of each locker, we need to consider how many times each locker is affected by the students' actions. Lockers that have an odd number of actions performed on them will remain open, while those that have an even number of actions performed on them will be closed.

For example, locker 1 is affected by student 1 (opened), student 3 (closed), student 5 (closed), and so on. A locker will be open if the number of times it is affected is odd, and closed if the number of times it is affected is even.

Since every locker starts closed and is initially affected by student 1 (opening it), it will have an odd number of actions performed on it if and only if it has an odd number of factors.

The factors of a number are pairs of numbers that, when multiplied, equal the number itself. For example, the factors of 12 are 1 and 12, 2 and 6, and 3 and 4.

In this case, we are interested in the number of factors each locker has, as that will determine whether it's open or closed. For a locker to have an odd number of factors, it must be a perfect square. Additionally, a perfect square can only be obtained by multiplying two distinct prime numbers together or by a single prime number being squared. For example, 4 (2^2), 9 (3^2), 25 (5^2), etc.

Therefore, the number of open lockers will be equal to the number of perfect squares less than or equal to 500. To find this, we can calculate the square root of 500 (which is approximately 22.36) and round it down to the nearest whole number. This gives us 22. So, there are 22 perfect squares less than or equal to 500.

Since there are 500 lockers in total, the number of closed lockers will be 500 - 22, which is 478.

In conclusion, after all the students have finished with the lockers, there will be 478 closed lockers and 22 open lockers.