Confusing Sequence and Series Problem A sequence 
$$
\ a_0, a_1, a_2, a_3, ...,a_n
$$
is composed only of nonnegative integers. Given that:
$$
\ a_2=5, a_{2014} = 2015, a_n=a_{a_{n-1}}
$$
for all positive integers $n$. How many possible values are there for $a_{2015}$?
If so what are they?
 A: There are infinitely many possible values for $a_{2015}$ because the following sequence satisfies the given condition for even $m\ge 4$ : 
$$a_n=\begin{cases}1&\text{if $n=0$}\\2&\text{if $n=1$}\\5&\text{if $n=2$}\\m&\text{if $n\ge 3$ is odd}\\2015&\text{if $n\ge4$ is even}\end{cases}$$ 
Especially, $a_{2015}=m$.
Proof : First, $a_i$ is a non-negative integer. Second, $a_2=5,a_{2014}=2015.$ 
Third, let us prove that $a_n=a_{a_{n-1}}$ by induction on $n\ge 1$.
For $n=1,2,3,4$, it holds trivially.
Suppose that if holds for $n=2k-1,2k$. Then, we have
$$a_{2(k+1)-1}=a_{a_{2k}}=a_{2015}=m,\ \ \ a_{2(k+1)}=a_{a_{2k+1}}=a_{m}=2015.$$
Hence, it holds for $n=2(k+1)-1,2(k+1)$. 
Hence, $a_n=a_{a_{n-1}}$ holds for any $n\ge 1$. Q.E.D.
A: I change a problem slightly.
Problem : what are the possible values for $a_{2015}$ ? 
Proof : Note that $$a_3=a_{a_2}=a_5:=M$$
                    Then $$ a_4=a_M,\ a_5=a_{a_M}(=M),\
                    a_6=a_M,\ a_7=M,\ a_8=a_M,\ \cdots $$
By induction we have $$n\geq 2\Rightarrow  a_{2n}=a_M,\ a_{2n-1}=M
$$
Since $a_{2014}=2015$, we have $$ a_M=2015 $$
Case 1 $M=odd$ : 
Case 1.1 $M\geq 3$ : $$ M=a_M=2015$$ And let
                    $a_0=1,\ a_1=2$
Case 1.2 $M=1$ : $$ a_1=a_{2014}=2015,\
                    a_2=a_{2015}=1 $$ Contradiction.
Case 2 $M=even$ : 
Case 2.1 $M=0$ : $$ 2015=
                     a_{2014}=a_0,\ a_1=a_{2015}=0,\ a_2=a_0=2015$$
                     Contradiction.
Case 2.2 $M=2$ : $$ 2015=a_2 $$ Contradiction.
Case 2.3 $M\geq 4$ : by mathlove, we can construct an example
Answer : So by Case 1.1 and Case 2.3, $2015$, or any even integer$\geq 4$ are only possible values for $a_{2015}$. So we complete the proof. 
