# Introduction and an example.

We are going to study a variant of the Josephus problem in this article. In this variant of the Josephus problem two numbers are to be eliminated at the same time, but two processes of elimination go for different directions. Let and be natural numbers such that . Suppose that there are -numbers. Then the first process of elimination starts with the 1 st number and the -th, -th, -th number, ... are to be eliminated. The second process starts with the -th number, and the -th, -th, -th number, ... are to be eliminated. We suppose that the first process comes first and the second process second at every stage. We denote the number that remains by .

The function has very interesting properties. It has fractal-like graphs. See Example 3.4. The sequence has a remarkable property when divided by 2. See Example 3.1. We denote by .

As to the author's other researches of the variant of the Josephus problem, see [1], [2] , [3] and [4].

Example 1.1   Suppose that there are numbers and . Then the 2nd and 4th number will be eliminated by the first process. Similarly 7th and 5th number will be eliminated by the second process. Then we have the following Figure. 1.1.
Here we covered eliminated numbers by the first process and the second process with gray color disks and gray color rectangles respectively, and the number with a underline was eliminated for the last time, and the number with a double underline was eliminated just before it. In Figure 1.1 the last number eliminated is 5 and 4 was eliminated before it. Now two directions are going to overlap. The first process will eliminate the 8,6 and the second process will eliminate 1. The number that remains is 3. See Figure 1.2.

Figure (1.1)
Figure (1.2)

Example 1.2   We are going to study another example. Suppose that there are numbers and . This time we calculate using a recursive relation. The 2nd, 4th, ...16th number will be eliminated by the first process. Similarly the 32th, 30th,...18th number will be eliminated by the second process. Then we have the following Figure 1.3.
In Figure 1.3 the last number eliminated is 18, and 16 was eliminated before it. Now two directions are going to overlap. The first process will eliminate the 19th, 23th, 27th, 31th and 1st, and the second process will eliminate the 15th, 11th, 7th, 3th.
Now we have 8 numbers that remain. See Figure 1.4

Figure (1.3)
Figure (1.4)
We are going to use a recursive relation to calculate . We have numbers {33,29,25,21,17,13,9,5}, and the next number to be eliminated is 29 and after that 9 will be eliminated. Suppose that we do not know the result of Example 1.1. If = 1 or 2 or 3 ... or 8, then = 33 or 29 or 25 or ...or 5 respectively. By comparing the values of and we can make a recursive relation
.
By the result of Example 1.1 we know that . This means that the third number of the list {33,29,25,21,17,13,9,5} will remain, and hence .