3. $n$ students sit in a circle, numbered $1,2, \cdots, n$ in clockwise order. The first student starts counting from 1, and whenever a student reports an even number, that student leaves the game, and the next student continues with the next number. Question: What is the number of the last student remaining in the circle?

将上面的文本翻译成英文，请保留源文本的换行和格式，直接输出翻译结果。 

Since the request is to directly output the translation while preserving the original text's line breaks and format, here is the final translation:

3. $n$ students sit in a circle, numbered $1,2, \cdots, n$ in clockwise order. The first student starts counting from 1, and whenever a student reports an even number, that student leaves the game, and the next student continues with the next number. Question: What is the number of the last student remaining in the circle?
Let $n$ people play a game, and the number of the last student remaining in the seat is denoted as $f(n)$.

When $n=2 k(k \geqslant 1)$, after the first round of counting, $k$ students remain, among whom the 1st student reports $2 k+1$, which is an odd number. This can be seen as $k$ students being renumbered and playing the game again (the $i$-th student is the original $(2 i-1)$-th student), and the number of the last remaining student is $f(k)$, whose original number is $f(2 k)=2 f(k)-1$.

When $n=2 k+1(k \geqslant 1)$, after the 1st student reports $2 k+2$ and exits, $k$ students remain (the 1st student reports $2 k+3$, which is an odd number), and they are renumbered and play the game again (the $i$-th student is the original $(2 i+1)$-th student). The number of the last remaining student is $f(k)$, and the original number is
$$
f(2 k+1)=2 f(k)+1 \text {. }
$$

It can be easily proven by mathematical induction: if $n=\left(a_{k} a_{k-1} \cdots a_{0}\right)_{2}$, then $f(n)=\sum_{i=0}^{k} 2^{i}(-1)^{a_{i}+1}$.