If there were 1,000 prisoners would the 400th prisoner escape.
Here is the puzzle could someone work it out and and respond to me please I am really confused with this:

In Transum prison there are 1000 prisoners in cells numbered 1 to 1000.

On day 1, the guard turns the key in every lock to open every cell.

On day 2, the guard turns the key in every cell which is a multiple of 2. This locks all the even numbered cells.

On day 3, the guard turns the key in every cell which is a multiple of 3, locking or unlocking them.

On day 4, the guard turns the key in every cell which is a multiple of 4, locking or unlocking them.

This continues for one thousand days. The prisoners whose cells are open after the 1000th day are set free. Which prisoners will be set free?

If there were 1,000 prisoners would the 400th prisoner escape.

Here is the puzzle could someone work it out and and respond to me please I am really confused with this:

In Transum prison there are 1000 prisoners in cells numbered 1 to 1000.

On day 1, the guard turns the key in every lock to open every cell.

On day 2, the guard turns the key in every cell which is a multiple of 2. This locks all the even numbered cells.

On day 3, the guard turns the key in every cell which is a multiple of 3, locking or unlocking them.

On day 4, the guard turns the key in every cell which is a multiple of 4, locking or unlocking them.

This continues for one thousand days. The prisoners whose cells are open after the 1000th day are set free. Which prisoners will be set free?