Far be it from me to step into the realm of mathematics, or to mar the excellent writeup above. But the history of Josephus's death differs from the quoted legend.

Josephus himself tells us the story (in Book III of The Jewish War) of how, in 67 AD, he flees from the fallen city of Jotapata and takes refuge in a cave. Therein he finds 40 men, resigned to their fates. The Romans track Josephus to the cave and besiege it, at one point setting a fire at the entrance. Josephus goes out to parley with the troops, and arranges a surrender. The 40 men, however, will have none of it, and propose mass suicide. Josephus harangues them, speaking in a very long-winded speech about the evils of suicide. The 40 call him a coward, and at this point Josephus suggests that they draw lots, each man killing the one who drew a chit before him. Josephus then says:

He (Josephus) however (should one say by fortune or by the providence of God?), was left alone with one other; and, anxious neither to be condemned by the lot nor, should he be left to the last, to stain his hand with the blood of a fellow countryman, he persuaded this man also, under a pledge, to remain alive. --Jewish War III.391

Josephus, of course, lives to write the story, and in fact is eventually adopted into the Flavian family of the Roman generals who were once his enemies. What a guy.