OFFSET
0,2
COMMENTS
This is a subsequence of A003285.
If a(n) is even then the smallest positive integer solution of the Pell equation x^2 - D(n)*y^2 = +1 with D(n) = A079896(n) is given by (x0, y0) = (P,Q) with P/Q = [a,b[1], ..., b[a(n)-1]. If a(n) is odd then the smallest positive integer solution of the Pell equation x^2 - D(n)*y^2 = +1 is given by (x0, y0) = (P^2 + D(n)*Q^2, 2*P*Q). See e.g., the Silverman reference Theorem 40.4 on p. 351.
REFERENCES
J. H. Silverman, A Friendly Introduction to Number Theory, 3rd ed., Pearson Education, Inc, 2006, p. 351.
EXAMPLE
a(0) = 1 because sqrt(5) = [2,repeat(4)].
a(1) = 2 because sqrt(8) = [2,repeat(1,4)].
a(23) = 11 because sqrt(61) = [7,repeat(1,4,3,1,2 2,1,3,4,1,14)].
Pell +1 equation: n = 23 with D = 61 has odd a(23)
P/Q = [7,1,4,3,1,2,2,1,3,4,1] = 29718/3805 (in lowest terms). Therefore (x0, y0) = (1766319049, 226153980), see A174762 (Of course, (1, 0) is the smallest nonnegative solution.)
MAPLE
See the Robert Israel program under A003285, adapted to n -> a(n).
MATHEMATICA
Length[Last@ #] & /@ ContinuedFraction@ Sqrt@ Select[Range@ 200, And[MemberQ[{0, 1}, Mod[#, 4]], ! IntegerQ@ Sqrt@ #] &] (* Michael De Vlieger, Feb 11 2016, after A079896 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wolfdieter Lang, Feb 03 2016
STATUS
approved