If $p$, $q$ and $r$ are positive integers and $p + \displaystyle\frac{1}{q + \displaystyle\frac{1}{r}} = \frac{129}{31}$ then what is the value of $p + q + r$?
I tried getting a common denominator, but nothing seems to work as the correct answer is an actual number
The fraction $$\frac1{q+\dfrac1r}$$ is lesser than $1$, so $$p=\left\lfloor\frac{129}{31}\right\rfloor=4$$ (The brackets $\lfloor\quad\rfloor$ mean "integer part").
Now, $$\frac1{q+\dfrac1r}=\frac{129}{31}-4=\frac5{31}$$ Therefore $$q+\frac1r=\frac{31}5$$
Proceed similarly to find $q$ and $r$.