%I #39 Sep 08 2021 13:19:22
%S 2,2,1,4,6,1,2,6,1,1,8,2,2,8,78,1,1,84,10,2,2,10,3,1,4,546,1,8,12,2,2,
%T 12,8,1,10,4,1062,3,1,7176,14,2,2,14,5,1,132,24,4,40,26,138,1,5,16,2,
%U 2,16,11934,1,3,60,826,4,250,10,6,39,1,12,18,2,2,18
%N a(n) is twice the coefficient of the radical part in the fundamental unit of Q(sqrt(A000037(n))) where A000037 lists the nonsquare numbers (Version 1).
%C From _Sean A. Irvine_, Jul 16 2021: (Start)
%C These values are computed by Algorithm 5.7.2 in Cohen.
%C Other methods of computation (see A346420) give different results, with the first difference at n=14.
%C (End)
%C a(n) is the smallest positive integer y satisfying the Pell equation x^2 - D*y^2 = +-4, where D = A000037(n). - _Jinyuan Wang_, Sep 08 2021
%D Henri Cohen, A Course in Computational Algebraic Number Theory, Springer-Verlag, 1993.
%H Jinyuan Wang, <a href="/A048942/b048942.txt">Table of n, a(n) for n = 1..1000</a>
%H S. R. Finch, <a href="http://www.people.fas.harvard.edu/~sfinch/">Class number theory</a>
%H Steven R. Finch, <a href="/A000924/a000924.pdf">Class number theory</a> [Cached copy, with permission of the author]
%H Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a048/A048942.java">Java program</a> (github)
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/FundamentalUnit.html">Fundamental Unit</a>.
%o (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(2*u2*v2/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*v2+u2*v1)/q; \\ _Jinyuan Wang_, Sep 08 2021
%Y Cf. A000037, A007913, A048941, A346419, A346420.
%K nonn
%O 1,1
%A _Eric W. Weisstein_
%E Name edited by _Michel Marcus_, Jun 26 2020
%E Entry revised by _Sean A. Irvine_, Jul 16 2021