OFFSET
1,1
COMMENTS
From Sean A. Irvine, Jul 16 2021: (Start)
These values are computed by Algorithm 5.7.2 in Cohen.
Other methods of computation (see A346419) give different results, with the first difference at n=14.
(End)
a(n) is the smallest positive integer x satisfying the Pell equation x^2 - D*y^2 = +-4, where D = A000037(n). - Jinyuan Wang, Sep 08 2021
REFERENCES
Henri Cohen, A Course in Computational Algebraic Number Theory, Springer-Verlag, 1993.
LINKS
Jinyuan Wang, Table of n, a(n) for n = 1..1000
S. R. Finch, Class number theory
Steven R. Finch, Class number theory [Cached copy, with permission of the author]
Sean A. Irvine, Java program (github)
Eric Weisstein's World of Mathematics, Fundamental Unit.
PROG
(PARI) a(n) = my(A, D=n+(1+sqrtint(4*n))\2, d=sqrtint(D), p, q, t, u1, u2, v1, v2); if(d%2==D%2, p=d, p=d-1); u1=-p; u2=2; v1=1; v2=0; q=2; while(v2==0 || q!=t, A=(p+d)\q; t=p; p=A*q-p; if(t==p && v2!=0, return((u2^2+D*v2^2)/q), t=A*u2+u1; u1=u2; u2=t; t=A*v2+v1; v1=v2; v2=t; t=q; q=(D-p^2)/q)); (u1*u2+D*v1*v2)/q; \\ Jinyuan Wang, Sep 08 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name edited by Michel Marcus, Jun 26 2020
Entry revised by Sean A. Irvine, Jul 13 2021
STATUS
approved