End of the year calculus challenge

Alright, my teacher has given us an end of the year calculus challenge problem that he would like to see if anyone understands.

The problem is:

"In order to pass calculus class, the student must sit in the right seat, give me a formula or equation that shows the correct seat for any possible size of class" (In this case of this problem, ONE person may pass the calculus class)

(we have 8 people in my calculus class....yes i know, small school)

He put us in a circle and then showed us the pattern.

First the 1st, 3rd, 5th, and 7th people in the circle (STARTING AT A COUNTER CLOCKWISE ROTATION) were removed from the possibilities, then he removed the 2nd and 6th people the next time he repeated the circle, afterwards he removed the 3rd which left the 8th person remaining.

I've been able to get the follow statistics (number of people in the circle / "winning seat")

2 - 2

3 - 2

4 -4

5 - 2

6 - 4

7 - 6

8 - 8

9 -2

10 -4

11 - 6

12 - 8

13 - 10

14-12

15-14

16 - 16

17 - 2

18 - 4

19 - 6

20 - 8

21 - 10

22 - 12

23 - 14

24 -16

25 - 18

and it continues in a pattern like that, does anyone have any idea how i would go about finding the equation(s) to solve this?