Recommend learning the following method for the continued fraction of $\sqrt n.$
All small numbers $|k| < \sqrt n$ that have a primitive representation as $x^2 - n y^2$ show up as $p^2 - n q^2,$ where $\frac{p}{q}$ is a convergent for $\sqrt n.$ As you can see, the only small represented numbers are $\pm 1.$ See Theorem 5.1 in KCONRAD
Method described by Prof. Lubin at Continued fraction of $\sqrt{67} - 4$
$$ \sqrt { 82} = 9 + \frac{ \sqrt {82} - 9 }{ 1 } $$
$$ \frac{ 1 }{ \sqrt {82} - 9 } = \frac{ \sqrt {82} + 9 }{1 } = 18 + \frac{ \sqrt {82} - 9 }{1 } $$
Simple continued fraction tableau:
$$
\begin{array}{cccccccc}
& & 9 & & 18 & & 18 & \\
\\
\frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 9 }{ 1 } & & \frac{ 163 }{ 18 } \\
\\
& 1 & & -1 & & 1
\end{array}
$$
$$
\begin{array}{cccc}
\frac{ 1 }{ 0 } & 1^2 - 82 \cdot 0^2 = 1 & \mbox{digit} & 9 \\
\frac{ 9 }{ 1 } & 9^2 - 82 \cdot 1^2 = -1 & \mbox{digit} & 18 \\
\frac{ 163 }{ 18 } & 163^2 - 82 \cdot 18^2 = 1 & \mbox{digit} & 18 \\
\end{array}
$$
========================================================
a different example:
$$ \sqrt { 229} = 15 + \frac{ \sqrt {229} - 15 }{ 1 } $$
$$ \frac{ 1 }{ \sqrt {229} - 15 } = \frac{ \sqrt {229} + 15 }{4 } = 7 + \frac{ \sqrt {229} - 13 }{4 } $$
$$ \frac{ 4 }{ \sqrt {229} - 13 } = \frac{ \sqrt {229} + 13 }{15 } = 1 + \frac{ \sqrt {229} - 2 }{15 } $$
$$ \frac{ 15 }{ \sqrt {229} - 2 } = \frac{ \sqrt {229} + 2 }{15 } = 1 + \frac{ \sqrt {229} - 13 }{15 } $$
$$ \frac{ 15 }{ \sqrt {229} - 13 } = \frac{ \sqrt {229} + 13 }{4 } = 7 + \frac{ \sqrt {229} - 15 }{4 } $$
$$ \frac{ 4 }{ \sqrt {229} - 15 } = \frac{ \sqrt {229} + 15 }{1 } = 30 + \frac{ \sqrt {229} - 15 }{1 } $$
Simple continued fraction tableau:
$$
\begin{array}{cccccccccccccccccccccccc}
& & 15 & & 7 & & 1 & & 1 & & 7 & & 30 & & 7 & & 1 & & 1 & & 7 & & 30 & \\
\\
\frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 15 }{ 1 } & & \frac{ 106 }{ 7 } & & \frac{ 121 }{ 8 } & & \frac{ 227 }{ 15 } & & \frac{ 1710 }{ 113 } & & \frac{ 51527 }{ 3405 } & & \frac{ 362399 }{ 23948 } & & \frac{ 413926 }{ 27353 } & & \frac{ 776325 }{ 51301 } & & \frac{ 5848201 }{ 386460 } \\
\\
& 1 & & -4 & & 15 & & -15 & & 4 & & -1 & & 4 & & -15 & & 15 & & -4 & & 1
\end{array}
$$
$$
\begin{array}{cccc}
\frac{ 1 }{ 0 } & 1^2 - 229 \cdot 0^2 = 1 & \mbox{digit} & 15 \\
\frac{ 15 }{ 1 } & 15^2 - 229 \cdot 1^2 = -4 & \mbox{digit} & 7 \\
\frac{ 106 }{ 7 } & 106^2 - 229 \cdot 7^2 = 15 & \mbox{digit} & 1 \\
\frac{ 121 }{ 8 } & 121^2 - 229 \cdot 8^2 = -15 & \mbox{digit} & 1 \\
\frac{ 227 }{ 15 } & 227^2 - 229 \cdot 15^2 = 4 & \mbox{digit} & 7 \\
\frac{ 1710 }{ 113 } & 1710^2 - 229 \cdot 113^2 = -1 & \mbox{digit} & 30 \\
\frac{ 51527 }{ 3405 } & 51527^2 - 229 \cdot 3405^2 = 4 & \mbox{digit} & 7 \\
\frac{ 362399 }{ 23948 } & 362399^2 - 229 \cdot 23948^2 = -15 & \mbox{digit} & 1 \\
\frac{ 413926 }{ 27353 } & 413926^2 - 229 \cdot 27353^2 = 15 & \mbox{digit} & 1 \\
\frac{ 776325 }{ 51301 } & 776325^2 - 229 \cdot 51301^2 = -4 & \mbox{digit} & 7 \\
\frac{ 5848201 }{ 386460 } & 5848201^2 - 229 \cdot 386460^2 = 1 & \mbox{digit} & 30 \\
\end{array}
$$
====================================
$$ \sqrt { 106} = 10 + \frac{ \sqrt {106} - 10 }{ 1 } $$
$$ \frac{ 1 }{ \sqrt {106} - 10 } = \frac{ \sqrt {106} + 10 }{6 } = 3 + \frac{ \sqrt {106} - 8 }{6 } $$
$$ \frac{ 6 }{ \sqrt {106} - 8 } = \frac{ \sqrt {106} + 8 }{7 } = 2 + \frac{ \sqrt {106} - 6 }{7 } $$
$$ \frac{ 7 }{ \sqrt {106} - 6 } = \frac{ \sqrt {106} + 6 }{10 } = 1 + \frac{ \sqrt {106} - 4 }{10 } $$
$$ \frac{ 10 }{ \sqrt {106} - 4 } = \frac{ \sqrt {106} + 4 }{9 } = 1 + \frac{ \sqrt {106} - 5 }{9 } $$
$$ \frac{ 9 }{ \sqrt {106} - 5 } = \frac{ \sqrt {106} + 5 }{9 } = 1 + \frac{ \sqrt {106} - 4 }{9 } $$
$$ \frac{ 9 }{ \sqrt {106} - 4 } = \frac{ \sqrt {106} + 4 }{10 } = 1 + \frac{ \sqrt {106} - 6 }{10 } $$
$$ \frac{ 10 }{ \sqrt {106} - 6 } = \frac{ \sqrt {106} + 6 }{7 } = 2 + \frac{ \sqrt {106} - 8 }{7 } $$
$$ \frac{ 7 }{ \sqrt {106} - 8 } = \frac{ \sqrt {106} + 8 }{6 } = 3 + \frac{ \sqrt {106} - 10 }{6 } $$
$$ \frac{ 6 }{ \sqrt {106} - 10 } = \frac{ \sqrt {106} + 10 }{1 } = 20 + \frac{ \sqrt {106} - 10 }{1 } $$
Simple continued fraction tableau:
$$
\begin{array}{cccccccccccccccccccccccccccccccccccccccc}
& & 10 & & 3 & & 2 & & 1 & & 1 & & 1 & & 1 & & 2 & & 3 & & 20 & & 3 & & 2 & & 1 & & 1 & & 1 & & 1 & & 2 & & 3 & & 20 & \\
\\
\frac{ 0 }{ 1 } & \frac{ 1 }{ 0 } & & \frac{ 10 }{ 1 } & & \frac{ 31 }{ 3 } & & \frac{ 72 }{ 7 } & & \frac{ 103 }{ 10 } & & \frac{ 175 }{ 17 } & & \frac{ 278 }{ 27 } & & \frac{ 453 }{ 44 } & & \frac{ 1184 }{ 115 } & & \frac{ 4005 }{ 389 } & & \frac{ 81284 }{ 7895 } & & \frac{ 247857 }{ 24074 } & & \frac{ 576998 }{ 56043 } & & \frac{ 824855 }{ 80117 } & & \frac{ 1401853 }{ 136160 } & & \frac{ 2226708 }{ 216277 } & & \frac{ 3628561 }{ 352437 } & & \frac{ 9483830 }{ 921151 } & & \frac{ 32080051 }{ 3115890 } \\
\\
& 1 & & -6 & & 7 & & -10 & & 9 & & -9 & & 10 & & -7 & & 6 & & -1 & & 6 & & -7 & & 10 & & -9 & & 9 & & -10 & & 7 & & -6 & & 1
\end{array}
$$
$$
\begin{array}{cccc}
\frac{ 1 }{ 0 } & 1^2 - 106 \cdot 0^2 = 1 & \mbox{digit} & 10 \\
\frac{ 10 }{ 1 } & 10^2 - 106 \cdot 1^2 = -6 & \mbox{digit} & 3 \\
\frac{ 31 }{ 3 } & 31^2 - 106 \cdot 3^2 = 7 & \mbox{digit} & 2 \\
\frac{ 72 }{ 7 } & 72^2 - 106 \cdot 7^2 = -10 & \mbox{digit} & 1 \\
\frac{ 103 }{ 10 } & 103^2 - 106 \cdot 10^2 = 9 & \mbox{digit} & 1 \\
\frac{ 175 }{ 17 } & 175^2 - 106 \cdot 17^2 = -9 & \mbox{digit} & 1 \\
\frac{ 278 }{ 27 } & 278^2 - 106 \cdot 27^2 = 10 & \mbox{digit} & 1 \\
\frac{ 453 }{ 44 } & 453^2 - 106 \cdot 44^2 = -7 & \mbox{digit} & 2 \\
\frac{ 1184 }{ 115 } & 1184^2 - 106 \cdot 115^2 = 6 & \mbox{digit} & 3 \\
\frac{ 4005 }{ 389 } & 4005^2 - 106 \cdot 389^2 = -1 & \mbox{digit} & 20 \\
\frac{ 81284 }{ 7895 } & 81284^2 - 106 \cdot 7895^2 = 6 & \mbox{digit} & 3 \\
\frac{ 247857 }{ 24074 } & 247857^2 - 106 \cdot 24074^2 = -7 & \mbox{digit} & 2 \\
\frac{ 576998 }{ 56043 } & 576998^2 - 106 \cdot 56043^2 = 10 & \mbox{digit} & 1 \\
\frac{ 824855 }{ 80117 } & 824855^2 - 106 \cdot 80117^2 = -9 & \mbox{digit} & 1 \\
\frac{ 1401853 }{ 136160 } & 1401853^2 - 106 \cdot 136160^2 = 9 & \mbox{digit} & 1 \\
\frac{ 2226708 }{ 216277 } & 2226708^2 - 106 \cdot 216277^2 = -10 & \mbox{digit} & 1 \\
\frac{ 3628561 }{ 352437 } & 3628561^2 - 106 \cdot 352437^2 = 7 & \mbox{digit} & 2 \\
\frac{ 9483830 }{ 921151 } & 9483830^2 - 106 \cdot 921151^2 = -6 & \mbox{digit} & 3 \\
\frac{ 32080051 }{ 3115890 } & 32080051^2 - 106 \cdot 3115890^2 = 1 & \mbox{digit} & 20 \\
\end{array}
$$