# Adapted from a past Putnam problem

Let $$(a_n)_{n=1}^{\infty}$$ be a sequence of $$1$$s and $$2$$s such that $$a_1 = 1$$ and $$a_n$$ is the number of $$2s$$ between the $$n^{th}$$ and $$(n+1)^{th}$$ $$1s$$ in the sequence. So the sequence starts out like this: $1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, ...$

Prove (if you wish) that there exists a real number $$r$$ such that $$a_n = 1$$ if and only if $$n = 1 + \lfloor rk \rfloor$$ for some $$k \in \mathbb{N}$$.

If $$r$$ can be written in simplest form as $$r = \frac{\alpha+\sqrt{\beta}}{\gamma}$$ where $$\alpha, \beta, \gamma$$ are coprime natural numbers, find $$\alpha^2+\beta^2+\gamma^2$$.

×