Legend has it that Josephus wouldn't have lived to become famous without his mathematical talents. During the Jewish-Roman war, he was among a band of 41 Jerish rebels trapped in a cave by Romans. Preferring suicide to capture, the rebels decide to form a circle, and proceeding around it, to kill every third remaining person until no one was left. But Josephus, among with an unindicted co-conspirator, wanted none of this suicide nonsense; so he quickly calculated where he and his friend should stand in the vicious circle.
In our variation, we start with people numbered 1 to around a circle, and we eliminate every remaining person until ONLY one survives. For example, here's the starting configuration for =10.
The elimination order is 2, 4, 6, 8, 10, 3, 7, 1, 9, so 5 survives. The problem: determine the survivor's number .
Suppose that we have people originally. After the first goround, we are left with 1, 3, 5, 7, ... , . and 3 will be the next to go. this is just like starting out with people, except that each person's number has been doubled and decreased by 1. That is,
But what about the odd case? with people, it turns out that person number 1 is wiped out just after person number , and we are left with 3, 5, 7, 9, ..., .
Again we almost have teach original situation with people, But this time their number is doublede and increased by 1. Thus
Noticing that .
Now we seek a closed form, because that will be even quicker and more informative. After all, that is a matter of life or death.
Our recurrence makes it possible to build a table of small values very quickly. Perhaps we'll be able to splot a pattern and guess the answer.
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
1 |
1 |
3 |
1 |
3 |
5 |
7 |
1 |
It seems we can group by power of 2. is always 1 at the beginning of group and it increases by 2 within a group. So if we write in the form , where is the largest power of 2 not exceeding and where is what's left, the solution to our recurrence seems to be
We must now prove this function.The induction step has two parts, depending on whether is odd or even. If and , then is even and
A similar proof works in the odd case, when . We might also note that .