OFFSET
1,1
COMMENTS
Given a discriminant D, the Pell equation x^2-D*y^2=1 has a minimum solution x as tabulated in A033313. We start with a set of candidates D of the form (2*n+1)^2-(2*m)^2, obviously all odd, where m runs through the integers from 1 to n.
Whichever D out of this set generates the smallest x in A033313, defines a(n)=D.
LINKS
Ray Chandler, Table of n, a(n) for n = 1..499
EXAMPLE
For n=4, the candidates are D=77 (m=1, index 69 in A000037), D=65 (m=2, index 57 in A000037), D=45 (m=3, index 39 in A000037) and D=17 (m=4, index 13 in A000037), which produce x = 351, x=129, x=161 and x=33 in that order (apply the offset in A033313 while converting indices from A000037 to find the x). Because 33 is the smallest of these four x, we select the associated D=17 as a(4).
MAPLE
A033313 := proc(Dcap) local c, i, fr, nu, de ; if issqr(Dcap) then -1; else c := numtheory[cfrac](sqrt(Dcap)) ; for i from 1 do try fr := numtheory[nthconver](c, i) ; nu := numer(fr) ; de := denom(fr) ; if nu^2-Dcap*de^2=1 then RETURN(nu) ; fi; catch: RETURN(-1) ; end try; od: fi: end:
A074074 := proc(n) local Dmin, xmin, Dcap ; Dmin := -1 ; xmin := -1; for m from 1 to n do Dcap := (2*n+1+2*m)*(2*n+1-2*m) ; x := A033313(Dcap) ; if xmin = -1 or (x >0 and x<xmin ) then Dmin := Dcap ; xmin := x ; fi; od: Dmin ; end:
seq(A074074(n), n=1..50) ; # R. J. Mathar, Sep 21 2009
MATHEMATICA
a[n_] := Module[{dd, sols, x, y}, dd = Table[(2 n + 1)^2 - 4 m^2, {m, 1, n}]; sols = Table[{d, x /. Solve[x > 0 && y > 0 && x^2 - d y^2 == 1, {x, y}, Integers]}, {d, dd}] /. C[1] -> 1 // Select[#, #[[2]] != {}&]&; MinimalBy[sols, #[[2, 1]]&][[1, 1]]]; Array[a, 50] (* Jean-François Alcover, Oct 23 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Lekraj Beedassy, Aug 28 2002
EXTENSIONS
Definition clarified, sequence extended beyond a(7) - R. J. Mathar, Sep 21 2009
STATUS
approved