Q:

Proving that if $f$ is continuous then $f(a_n)$ converges

Suppose $f$ is continuous on the closed interval $[0,1]$ such that $f(0)=f(1)$. Prove that if $$(a_n)=\left(\frac{n(1+\cos(\pi n))}{2 n+1}\right)$$
then the sequence $(f(a_n))$ converges. 
I noticed that $a_n$ goes back and forward from $0$ to $1$ for all $n>0$. I tried playing with the intermediate value theorem but with no luck. What am I missing? Any suggestions?

A:

Hint $f(a_n)$ converges if and only if $f(a_{2n})$ and $f(a_{2n+1})$ converge to the same limit.

