A man puts on a clean shirt every night before bed. On the first nigh he puts on a blue shirt. He than sleeps for 5 hours. Every one hour more he sleeps than the night before he put on a different color shirt the next night according to this scale: blue, black, red, green, white, pink, orange, brown, purple, yellow, grey, neon green, tan, and teal. Every one hour less he sleeps than the last night he put on a different color shirt the next night going backwards on his scale.
If he were to wear a blue shirt because he slept more hours than the last night he does. If it was because he slept less hours than the night before he skips it and wears a teal shirt instead. If he goes backwards on the scale and goes to blue but would not wear a blue shirt he still counts blue in his going backwards on his scale.
The second night the man wears a blue shirt because he did not sleep any more or less hours than the last night. The man sleeps for six hours that night.
The next night he sleeps for five hours.
Night number four he sleeps for eight hours.
The next night he sleeps for seven hours.
The next night he sleeps so well he sleeps for 11 hours.
Night number seven he stays up so late he only sleeps for four hours.
The next night he is so tired he sleeps for eight hours.
The next night he sleeps for eight hours again.
Night number ten he sleeps for 14 hours because he is sick.
Since he slept so long the last night he only sleeps for seven hours.
The next night he is a little bit tired so he sleeps for eight hours.
The night after that he had to do so much work he only slept five hours.
The next night at work they let him out early and he slept for nine hours.
The next night he slept for eight hours.
And the last night the man did he slept for ten hours.
The next night he put on a different color shirt according to his scale, but the next night he randomly picked a shirt. At what night will the man wear a blue shirt again?
SEE ANSWER
Locker 1,000,000 will be open.
If you think about it, the number of times that each locker is flipped is equal to the number of factors it has. For example, locker 12 has factors 1, 2, 3, 4, 6, and 12, and will thus be flipped 6 times (it will end be flipped when you flip every one, every 2nd, every 3rd, every 4th, every 6th, and every 12th locker). It will end up closed, since flipping an even number of times will return it to its starting position. You can see that if a locker number has an even number of factors, it will end up closed. If it has an odd number of factors, it will end up open.
As it turns out, the only types of numbers that have an odd number of factors are squares. This is because factors come in pairs, and for squares, one of those pairs is the square root, which is duplicated and thus doesn't count twice as a factor. For example, 12's factors are 1 x 12, 2 x 6, and 3 x 4 (6 total factors). On the other hand, 16's factors are 1 x 16, 2 x 8, and 4 x 4 (5 total factors).
So lockers 1, 4, 9, 16, 25, etc... will all be open. Since 1,000,000 is a square number (1000 x 1000), it will be open as well.