The Josephus problem
Medium
people numbered to stand in a circle. Going around the circle starting from person 1, every second person is removed (first person 2, then 4, and so on, continuing around the circle) until one person remains. Find a formula for the position of the survivor.