# Period of continued fraction expansion and class number

Let $$d>1$$ be not a square. Then the continued fraction expansion of $$\sqrt d$$ is $$[a_0; \overline{a_1,\dots,a_\ell}]$$, where $$a_0=\lfloor \sqrt d\rfloor$$ and $$a_\ell=2a_0$$. Thus, $$\ell=\ell(d)$$.

About 30 years ago I heard a talk where $$\ell(d)$$ was somehow related to the class number of $$\mathbb Q(d)$$ -- in particular, to the Gauss class number problem which conjectures that there are infinitely many natural $$d$$ for which class number is 1.

Unfortunately, I don't remember how to restate this conjecture via $$\ell(d)$$. Any reference would be helpful.

• Should $a_0=\lfloor d \rfloor$ be $a_0=\bigl\lfloor \sqrt d\,\bigr \rfloor$? Apr 9, 2022 at 10:57
• This should go via Pell's equation: if you want a fundamental unit for $\mathbb{Q}(\sqrt{d})$ then this amounts to solving $T^2-dU^2=1$, and this reduces to computing a continued fraction expansion of $\sqrt{d}$. Then the regulator of the field should give a connection back to class number. Apr 9, 2022 at 11:23
• Yes, Joe. Fixed. Apr 9, 2022 at 11:32
• For real quadratic fields, the regulator is just the logarithm of the fundamental unit. It is one of the quantities involved in Dirichlet's class number formula, class number itself of course being another. Apr 9, 2022 at 11:55
• The deleted answer of Henri Cohen contains a reference math.stackexchange.com/questions/438686 which is useful for real fields also: "one is able to express, for a prime $p$ of form $4m − 1$, $p > 3$, the class number of the quadratic ﬁeld of discriminant $−p$ in terms of the period of the continued fraction for $p^{1/2}$ <i>whenever the class number of the quadratic ﬁeld of discriminant $4p$ is one.</i>" Apr 9, 2022 at 17:55

Let $$m>1$$ be a squarefree integer. Then the class number of $${\bf Q}(\sqrt m)$$ is one if and only if $$\theta+\sum_{i=1}^{\ell}k_i=\lambda_1(m)+\lambda_2(m)$$ where $$\omega=(1+\sqrt m)/2$$ if $$m\equiv1\bmod4$$, otherwise $$\omega=\sqrt m$$, the continued fraction for $$\omega$$ is $$[k_0,\overline{k_1,\dots,k_{\ell}}]$$, $$\theta$$ is zero, one, or two depending on $$m\bmod4$$ and the parity of $$\ell$$ and $$k_{\ell/2}$$, and $$\lambda_1(m)$$ (respectively, $$\lambda_2(m)$$) is the number of solutions in nonnegative integers of $$x^2+4yz=\Delta$$ (respectively, $$x^2+4y^2=\Delta$$), where $$\Delta$$ is $$m$$ if $$m\equiv1\bmod4$$, otherwise $$4m$$.
For the detailed definition of $$\theta$$, see the paper of Levesque. The paper goes on to prove related results.