4. Find
$$
\frac{\sqrt{31+\sqrt{31+\sqrt{31+\ldots}}}}{\sqrt{1+\sqrt{1+\sqrt{1+\ldots}}}} .
$$
Answer: $6-\sqrt{5}$
Solution: Let the numerator be $x$ and the denominator $y$. Then $x^{2}=31+x$, so, as $x>0$, we have
$$
x=\frac{1+\sqrt{1+4 \cdot 31}}{2}=\frac{1+5 \sqrt{5}}{2} .
$$

Similarly we compute that
$$
y=\frac{1+\sqrt{1+4 \cdot 1}}{2}=\frac{1+\sqrt{5}}{2},
$$
so that
$$
\frac{x}{y}=\frac{1+5 \sqrt{5}}{1+\sqrt{5}}=\frac{1+5 \sqrt{5}}{1+\sqrt{5}} \cdot \frac{1-\sqrt{5}}{1-\sqrt{5}}=\frac{-24+4 \sqrt{5}}{-4}=6-\sqrt{5} .
$$