There are 128 numbers 1, 2, . . . , 128 which are arranged in a circular pattern in clockwise order. We start deleting numbers from this set in a clockwise fashion as follows. First delete the number 2, then skip the next available number (which is 3) and delete 4. Continue in this manner, that is, after deleting a number, skip the next available number clockwise and delete the number available after that, till only one number remains. What is the last number left ? Source
Some examples I've calculated by considering shorter number strings: $$ 1,2 \to 1$$ $$ 1,2,3 \to 3$$ $$ 1,2,3,4 \to 1$$ $$ 1,2,3,4,5 \to 3$$ $$ 1,2,3,4,5,6 \to 5$$ $$ 1,2,3,4,5,6,7 \to 7$$
$$ 1,2,3,4,5,6,7,8 \to 1 $$ $$ 1,2,3,4,5,6,7,8,9 \to 3 $$
I can't see any pattern in the number the string gets shot down to. Any how I tried a brute-forcish approach by doing the deletion in cycles (everytime I look back to the beginning numbers, I put an arrow):
$$ 1,2,3,4....,(128) \to 1,3,5,7....(127) \to 1,7,11 ..(??)$$
Quickly I figured that this is NOT the approach.
A bit later on, I thought of a more 'generating functionish' approach:
I thought of considering the number as a polynomial $p(x) = x^1 + x^2...+x^{128}$ then I thought maybe if I could find an operation which captures the 'deletion' process as described by the question onto this polynomial, then I would have solved the question. However, I could find only find such a process for the 'first sieve' i.e: the first time we delete till the end and reach back at the starting numbers. It is given as:
$$p_1(x) = \frac{p(x)+p(-x)}{2}$$
Annnnnd I am out of ideas