WOLFRAM NOTEBOOK

WOLFRAM|DEMONSTRATIONS PROJECT

Bidirectional Variant of Josephus Problem

demo
graph
number of people n
20
steps
0
The classical version of the Josephus problem counts off
n
people arranged in a circle and eliminates every second person. The process continues until only one person is left.
In this variant of the Josephus problem, as in the original problem, the counting is by twos. However, people are counted off alternately in opposite directions around the circle, starting from 1. When someone is counted off twice, that person is eliminated.
For example, suppose that there are 10 people. The positions of the people counted off are at
2,9,4,7,6,5,8,3,10,1,2,
. Since 2 is counted off twice, it is eliminated and the counting continues, skipping over person 2 from now on. After a while only one person is left, the survivor.
A person is covered with a gray disk or rectangle when first counted off and covered with a red disk or blue rectangle when counted off a second time and thus eliminated.
Denote the position of the survivor by
S(n)
. The graph of the list
{(n,S(n)),n=1,2,...}
is a fractal.
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.