Let $a_1,a_2,\dots$ be a sequence of integers satisfying $a_1=2$ and: $$a_n=\begin{cases}a_{n-1}+1, & \text{ if }n\ne a_k \text{ for some }k=1,2,\dots,n-1; \\ a_{n-1}+2, & \text{ if } n=a_k \text{ for some }k=1,2,\dots,n-1. \end{cases}$$Find the value of $a_{2022!}$.
Problem
Source: OlimphÃada 2022- Problem 4/Level 2
Tags: algebra, Sequence
26.07.2022 11:15
I got $a_n=\left\lceil\frac{1+\sqrt{5}}{2}n\right\rceil$ but how could I calculate $a_{2022!}$?
28.07.2022 22:03
See that $\lceil\phi\rceil=2=a_1$. We prove by induction that $a_n=\lceil n\phi\rceil$. We have: $$a_n=a_{n-1}+1+f(n),$$where $$f(n)=\begin{cases}1\text{ if }n=a_i\text{ for some }i;\\0\text{ if else.}\end{cases}$$It's easy to see that, if $a_i=n\implies i\leq n-1$. From the recurrence we have: $$a_n=n+1+\sum_{2\leq k\leq n}f(k)=n+1+g(n)$$See that $g(n)$ is the amount of elements from $\{2,3,\dots,n\}$ which are in the sequence. Now, suppose that $a_k=\lceil k\phi\rceil$ for $k=1,2,\dots,n-1$. We have: $$a_k\leq n\iff k\phi\leq n\iff k\leq\left\lfloor\frac{n}{\phi}\right\rfloor\implies g(n)=\left\lfloor\frac{n}{\phi}\right\rfloor.$$From this we conclude that: $$a_n=n+1+\left\lfloor\frac{n}{\phi}\right\rfloor=n+\left\lceil\frac{n}{\phi}\right\rceil=\left\lceil n\left(1+\frac{1}{\phi}\right)\right\rceil=$$$$=\lceil n\phi\rceil,$$as desired. $\blacksquare$