login
Least D in the Pellian x^2 - D*y^2 = 1 for which x has least solution n.
8

%I #30 Jun 08 2022 03:56:36

%S 3,2,15,6,35,12,7,5,11,30,143,42,195,14,255,18,323,10,399,110,483,33,

%T 23,39,27,182,87,210,899,60,1023,17,1155,34,1295,38,1443,95,1599,105,

%U 1763,462,215,506,235,138,47,96,51,26,2703,78,2915,21,3135,203,3363

%N Least D in the Pellian x^2 - D*y^2 = 1 for which x has least solution n.

%C The i-th solution pair V(i) = [x(i), y(i)] to the Pellian x^2 - D*y^2 = 1 for a given least solution x(1) = n may be generated through the recurrence V(i+2) = 2*n*V(i+1) - V(i) taking V(0) = [1, 0] and V(1) = [n, sqrt((n^2-1)/a(n))]. V(i) stands for the numerator and denominator of the 2i-th convergent of the continued fraction expansion of sqrt(D).

%C Thus setting n = 3, for instance, we have D = a(3) = 2 and V(1) = [3, 2] so that along with V(0) = [1, 0] recurrence V(i+2) = 6*V(i+1) - V(i) generates [A001333(2k), A000129(2k)]. Similarly, setting n = 9 generates [A023039, A060645], respectively the numerator and denominator of the 2i-th convergent of sqrt(a(9)), i.e., sqrt(5). - _Lekraj Beedassy_, Feb 26 2002

%H Ray Chandler, <a href="/A033314/b033314.txt">Table of n, a(n) for n = 2..1001</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PellEquation.html">Pell Equation</a>.

%t squarefreepart[n_] :=

%t Times @@ Power @@@ ({#[[1]], Mod[#[[2]], 2]} & /@ FactorInteger[n]);

%t pellminx[d_] := Module[{q, p, z}, {q, p} = ContinuedFraction[Sqrt[d]];

%t If[OddQ[p // Length], p = Join[p, p]];

%t z = FromContinuedFraction[Join[{q}, Drop[p, -1]]]; Numerator[z]]

%t NMAX = 60; a = {};

%t For[n = 2, n <= NMAX, n++, s = squarefreepart[n^2 - 1];

%t sd = s Divisors[Sqrt[(n^2 - 1)/s]]^2;

%t t = Sort[Transpose[{sd, pellminx[#] & /@ sd}]];

%t AppendTo[a, Select[t, #[[2]] == n &, 1][[1, 1]]]

%t ]; a (* _Herbert Kociemba_, Jun 05 2022 *)

%Y Cf. A000037, A033313, A033318.

%K nonn

%O 2,1

%A _Eric W. Weisstein_