C2. An expression like
$$
x=1+\frac{1}{2+\frac{1}{3+\frac{1}{4}}}
$$
is called a continued fraction.
(a) Write $x$ given above as a reduced fraction of the form $\frac{a}{b}$ where $a$ and $b$ are positive integers.
(b) Write $\frac{355}{113}$ as a continued fraction in the form $a+\frac{1}{b+\frac{1}{c}}$, where $a, b, c$ are positive integers.
(c) Let
$$
y=8+\frac{1}{8+\frac{1}{8+\frac{1}{8+\cdots}}}
$$
where the process continues indefinitely. Given that $y$ can be written in the form $p+\sqrt{q}$, find the integers $p$ and $q$.

C2.(c) Let
$$
y=8+\frac{1}{8+\frac{1}{8+\frac{1}{8+\cdots}}}
$$
where the process continues indefinitely. Given that $y$ can be written in the form $p+\sqrt{q}$, find the integers $p$ and $q$.
Solution for (a): Working from the bottom up we get
$$
\begin{aligned}
1+\frac{1}{2+\frac{1}{3+\frac{1}{4}}} & =1+\frac{1}{2+\frac{1}{\frac{13}{4}}} \\
& =1+\frac{1}{2+\frac{4}{13}} \\
& =1+\frac{1}{\frac{30}{13}} \\
& =1+\frac{13}{30} \\
& =\frac{43}{30}
\end{aligned}
$$

Solution for (b): Reversing the process from part a) we get
$$
\begin{aligned}
\frac{355}{113} & =3+\frac{16}{113} \\
& =3+\frac{1}{\frac{113}{16}} \\
& =3+\frac{1}{7+\frac{1}{16}}
\end{aligned}
$$

Solution for $(c)$ :
Notice that
$$
y=8+\frac{1}{y}
$$
which yields the quadratic equation
$$
y^{2}-8 y-1=0
$$
with solutions
$$
y=\frac{8 \pm \sqrt{68}}{2}
$$

Since clearly $y \geq 0$, we must have
$$
y=4+\sqrt{17} \text {. }
$$

Thus, $p=4$ and $q=17$.