The classical version of the Josephus problem counts off 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 . 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 . The graph of the list is a fractal.