Sequence sub sequences!

There is a sequence: $a_0, a_1, a_2, a_3, a_4, \ldots$ If $a_n=a_{a_{n−1}}, a_2=5$ and $a_{2014}=2015$, what are all possible values of $a_{2015}$?

I've tried to set $a_2=5$ and therefore $a_3=a_5$. From that I got that all even numbers greater than $2$ have to be equal, and that all odd numbers greater than $3$ had to be equal. Please help!

• Your question is very unclear, and you should probably format your math. Do you think you can take care of these problems? – Robin Goodfellow Nov 3 '14 at 0:41

We know $a_{2} = 5$, and since $a_{n} = a_{a_{n - 1}}$, we have: $$a_{3} = a_{a_{2}} = a_{5}.$$ Similarly, $$a_{4} = a_{a_{3}} = a_{a_{5}} = a_{6}.$$ And further $$a_{5} = a_{a_{4}} = a_{a_{6}} = a_{7}.$$
So it is not hard to see that we have $a_{3} = a_{5} = a_{7} = \dots$, and also $a_{4} = a_{6} = a_{8} = \dots$
• How can you infer from $a_{2015}=a_3$ that $a_{2015}=5?$ – mfl Nov 3 '14 at 1:03
• @mfl: You can't. In fact it appears to be consistent that the terms with odd index all be $5$ or all be the same positive even integer. – Brian M. Scott Nov 3 '14 at 1:15
• @mfl My mistake, I wrote up this solution thinking $a_{3} = 5$ at the end... – layman Nov 3 '14 at 1:49