Flavius Josephus, a Jewish-Roman historian from the first century, tells the story like this: A company of 40 soldiers, along with Josephus himself, were trapped in a cave by Roman soldiers during the Siege of Yodfat in 67 A.D. The Jewish soldiers chose to die rather than surrender, so they devised a system to kill off each other until only one person remained. (That last person would be the only one required to die by their own hand.)If Josephus really did the maths in his head under those circumstances, that's pretty impressive.
All 41 people stood in a circle. The first soldier killed the man to his left, the next surviving soldier killed the man to his left, and so on. Josephus was among the last two men standing, "whether we must say it happened so by chance, or whether by the providence of God," and he convinced the other survivor to surrender rather than die.
This tale may be apocryphal and fantastic, but it gives rise to a fascinating math problem. That is: If you're in a similar situation to Josephus, how do you know where to stand so you will be the last man standing? This is the subject of a new video from the wonderful YouTube channel Numberphile.
Background on the Josephus Problem is here and here.