The Josephus Problem

In the Jewish revolt against Rome, Josephus and 39 of his comrades were holding out against the Romans in a cave. With defeat imminent, they resolved that they would rather die than be slaves to the Romans. They decided to arrange themselves in a circle. One man was designated as number one, and they proceeded clockwise killing every seventh man… Josephus was among other things an accomplished mathematician; so he instantly figured out where he ought to sit in order to be the last to die. But when the time came, instead of killing himself he joined the Roman side. Find the position at which Josephus sat.

Remember, to solve this puzzle and appear on the leaderboard, email both your solution and your source code (in any language) to Good luck!!

View all puzzles »