# Circular jail

Question:

The warden of a circular jail is extremely hyper one day so he begins running around opening cells. The jail has 100 cells numbered from 1 to 100. He runs in a circle and opens all of the cells. Next he runs around and closes every 2nd cell (starting with cell 2, 4, 6 , etc.). If a cell is open he closes it and if a cell is closed he opens it. When he finishes running by all 100 cells he opens/closes every 3rd cell (starting with 3, 6, 9, 12 etc.), then every 4th cell (starting with 4, 8, 12, etc.) and so on. He does this until he goes around and only changes the 100th cell.

When he is done what cells will be open?

.

.

C

A

P

T

A

I

N

I

N

T

E

R

V

I

E

W

.

.

Solution: The cells 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100 will be open. Only the cells that have two of the same factors (4 = 2 * 2) will be open because they are opened and closed the same number of times (except 1 which is just opened). Since they have the same factor twice their number of factors is odd.