2015 pieces of stones are placed to form a circle. They are numbered with 1,2,3,4,...,2015 clockwise. Starting from somewhere, you remove a stone. Then going clockwise, you remove every other stone, one at a time. Finally, there is only stone left, and that stone is 2014. What was the first stone you removed?
By starting with 1 and with different numbers of stones a pattern emerges:
If the number of stones is 2^n then the last stone will be 2^n.
For every stone short of a power of 2, the last stone drops by 2.
(For 2^n  a, if a<2^(n1), the last stone is 2^n  2a)
2015 is 33 short of 2048=2^11.
2048  2*33 = 1982.
For 2015 stones, if you start with 1, you end with 1982.
Now just shift this by 20141982=32 places and start instead with
1+32=33

Posted by Jer
on 20171117 07:34:50 