Problem

Source: Bulgarian Autumn Tournament 2023, 9.4

Tags: number theory



Let $p, q$ be coprime integers, such that $|\frac{p} {q}| \leq 1$. For which $p, q$, there exist even integers $b_1, b_2, \ldots, b_n$, such that $$\frac{p} {q}=\frac{1}{b_1+\frac{1}{b_2+\frac{1}{b_3+\ldots}}}? $$