A group of 2017 students $S_0, S_1, S_2,\ldots, S_{2016}$ sit in this order around a circle, going clockwise.

Starting from student $S_0$ with the number 1, and going clockwise, they consecutively count the numbers 1, 2, and 3, and repeat.

Each student that counts 2 or 3 as they do this must leave the circle, and they continue until only one student $S_k$ remains.

Determine $k$ .

The answer is 1932.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

If there are $3^n$ students sitting around the circle, then after the first round of counting there remain $3^{n-1}$ students and student $S_0$ will count the same number $1$ in the second round.

So after $n$ rounds, $S_0$ will be the last student remaining.

Now suppose that there are $2017$ students.

Since $3^6 = 729 < 2017 < 3^7 = 2187$ , we can reduce our problem to the previous easy case when there are $3^6$ students left; then student $S_k$ will be the student who will count $1$ first among these $3^6$ students.

We need to remove $2017 - 729 = 1288 = 2\times 644$ students.

These correspond to $644$ groups of three students (with two left out from each group).

So we need $644\times 3 = 1932$ students sitting before $S_k$ , and hence $k = \boxed{1932}$ .