  Given positive integers $j,k$, with $j\geq 2$, we show that there are
positive integers $d,e$ such that $\sqrt{d}$ has continued fraction expansion
$\sqrt{d}=[e,\overline{k,\dots,k,2e}]$, with period $j$, if and only if $k$ is
even or $3\nmid j$, in which case we give closed formulae to find all such
$d,e$ as well as the smallest solution in positive integers to the Fermat-Pell
equation $X^2-dY^2=(-1)^j$.
