Given that I know if $d$ is an integer that $\sqrt{d}=[\alpha_0,\bar{\alpha_1},...\bar{\alpha_n},\bar{2\alpha_0}]$. I want to show that $\sqrt{d}$ has period length 1 if and only if $d=a^2+1$, for some natural number a.
Here is what I think I have to do , could someone please verify it for me ?
($\Leftarrow$) suppose $d=a^2+1$, then $\sqrt{d}=\sqrt{a^2+1}$.
$(a-1)^2\leq a^2+1, \Rightarrow (a-1)\leq \sqrt{a^2+1}$
So the floor of $\sqrt{a^2+1}$ is $a-1=\alpha_0$. Subtracting this and inverting gives:
$\tfrac{1}{\sqrt{a^2+1}-(a-1)}=\tfrac{\sqrt{a^2+1}+(a-1)}{2a}$, which has floor 1.
So we know $\alpha_1=1$, subtracting this and inverting gives:
$\tfrac{2a}{\sqrt{a^2+1}-(a-1)}=\tfrac{2a(\sqrt{a^2+1}+(a-1)}{2a}=\sqrt{a^2+1}+(a-1)$, which has floor $2a-2$, subtracting and inverting gives,
$\tfrac{1}{\sqrt{a^2+1}-(a-1)}$, so we're back to the start , and so the continued fraction has period length 1.
$(\Rightarrow) $ suppose $\sqrt{d}$ has period length 1. Then $\sqrt{d}=[\alpha_0,\bar{\alpha_1}]=[\alpha_0,\bar{\alpha_1},\bar{2\alpha_0}]$.
So then we can write :
$\sqrt{d}=\alpha_0+\tfrac{1}{\alpha_1+\tfrac{1}{2\alpha_0+\tfrac{1}{...}}}=\alpha_0+\tfrac{1}{\alpha_1+\tfrac{1}{2\sqrt{d}}}$.
I haven't got this to work out yet, but does showing $d=a^2+1$, come down to reaaranging what I've just written ?
$$\sqrt{a^2}\lt\sqrt{a^2+1}\lt\sqrt{a^2+2a+1}$$ $$\therefore a\lt\sqrt{a^2+1}\lt a+1\implies\left\lfloor\sqrt{a^2+1}\right\rfloor=a$$ Hence, $$\begin{align} \sqrt{d} &=\sqrt{a^2+1}\\ &=a+\sqrt{a^2+1}-a\\ &=a+\frac1{\left(\frac1{\sqrt{a^2+1}-a}\right)}\\ &=a+\frac1{a+\sqrt{a^2+1}}\\ &=a+\frac1{a+\sqrt{d}}\\ &=a+\frac1{2a+\frac1{a+\sqrt{d}}}\\ &=a+\frac1{2a+\frac1{2a+\dots}}\\ \end{align}$$ You should be able to prove the if and only if part yourself.