The Josephus problem - Jack the Ripper strikes again !!
Later on I found out that it was a variant of the popular "Josephus Problem" and boy, had I read the wiki page earlier, I would have solved the two questions in less than a minute !!
Here's a variant of the question :-
Assume that there is a circle of 997 people. And Jack the Ripper is free and on a killing spree. But he has strange rules. He says that he will kill every alternate person in the circle and leave the next one alive till he traverses the circle once. After that, he would again get the alive persons to form a smaller circle and the hacking (of necks 😀 would begin again and so on till he has been left with only one person.
The question is, for 997 people, what would be the position to stand in, if you want to be the lone survivor.
Another variant is for "n" people, and for a separation distance of "x" (in our case, n=997 , x=1) what can be the generalized position in terms of n and x ?