Mathematica 9 is now available

The Josephus Problem

Paul Wellin
Wolfram Research, Inc.

download notebookDownload this example as a Mathematica notebook.

Flavius Josephus was a Jewish historian during the Roman-Jewish war of the first century. Through his writings comes the following macabre story.

The Romans had chased a group of 10 Jews into a cave and were about to attack. Rather than dying at the hands of their enemy, the group chose to commit suicide one by one. Legend has it, though, that they decided to go around their circle of 10 individuals and eliminate every other person until no one was left. Who was the last to die?

A Functional Approach

A Recurrence Relation

A Closed Form

Cyclic Shifts

Functional Programming the Binary Shift