This question was asked about a group of people whom a king wishes to play a cruel game with. Going around in a circle, the king kills every other person.
The question concerned how one could compute the answer without executing the sequence, and this answer comes out to $n=2^m+p$, where $n$ is the number of people, $2^m$ is the highest value less than $n$, and $p$ is the seat number of the person who lives.
What happens if the king kills every third person? Fourth person? For convenience, let $s$ be the number of seats skipped.
I've worked out the first few digits in the sequence where $s=3$, as $1, 2, 2, 1, 4, 1, 4, 7$, but I don't see a pattern here. I imagine I'd have to generate quite a number of these to see the pattern. The first few digits where $s=4$ are $1, 2, 3, 2, 1, 5, 2, 6, 1$.
How does one generate this sequence in a generic way for any $s$?