Josephus Problem

Classic Problem
This is the original Josephus problem, of which all others are variants.

, along with $40$ comrades in arms, have opted to commit suicide rather than fall into the hands of the Romans.

Because he really wants to stay alive, he suggests that they all stand in a circle, and count around it.

Every $3$rd person counted was to drop out of the circle and die.

Where did place himself, and his companion who also did not want to die, so that the two of them would remain the last two standing?

Solution
They placed themselves at positions $16$ and $31$ in the circle of $41$.

Proof
On the first time round the circle, we lose the people at positions:
 * $3$, $6$, $9$, $12$, $15$, $18$, $21$, $24$, $27$, $30$, $33$, $36$ and $39$.

We are left with:
 * $1$, $2$, $4$, $5$, $7$, $8$, $10$, $11$, $13$, $14$, $16$, $17$, $19$, $20$, $22$, $23$, $25$, $26$, $28$, $29$, $31$, $32$, $34$, $35$, $37$, $38$, $40$, $41$

Counting $3$ round from the now eliminated $39$ leads us to $1$, and so the following are eliminated from the above:
 * $1$, $5$, $10$, $14$, $19$, $23$, $28$, $32$, $37$, $41$

Now we are left with:
 * $2$, $4$, $7$, $8$, $11$, $13$, $16$, $17$, $20$, $22$, $25$, $26$, $29$, $31$, $34$, $35$, $38$, $40$

Counting $3$ round from the now eliminated $41$ leads us to $7$, and so the following are eliminated from the above:
 * $7$, $13$, $20$, $26$, $34$, $40$

Now we are left with:
 * $2$, $4$, $8$, $11$, $16$, $17$, $22$, $25$, $29$, $31$, $35$, $38$

Counting $3$ round from the now eliminated $40$ leads us to $8$, and so the following are eliminated from the above:
 * $8$, $17$, $29$, $38$

Now we are left with:
 * $2$, $4$, $11$, $16$, $22$, $25$, $31$, $35$

Counting $3$ round from the now eliminated $38$ leads us to $11$, and so the following are eliminated from the above:
 * $11$, $25$

Now we are left with:
 * $2$, $4$, $16$, $22$, $31$, $35$

Counting $3$ round from the now eliminated $25$ leads us to $2$, and so the following are eliminated from the above:
 * $2$, $22$

Now we are left with:
 * $4$, $16$, $31$, $35$

Counting $3$ round from the now eliminated $22$ leads us to $4$, and so the following are eliminated from the above:
 * $4$, $35$

Now we are left with:
 * $16$, $31$

which is what we wanted to know.