OFFSET
1,1
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
S. R. Finch, Class number theory [Cached copy, with permission of the author]
Bernard Frénicle de Bessy, Solutio duorum problematum circa numeros cubos et quadratos, (1657). Bibliothèque Nationale de Paris. See column C page 19.
H. W. Lenstra, jr., Solving the Pell Equation, Notices of the AMS, Vol.49, No.2, Feb. 2002, p.182-192.
F. Richman and R. Mines, Pell's equation
Derek Smith, Historical Overview of Pell Equations
Eric Weisstein's World of Mathematics, Pell Equation
FORMULA
a(n) = sqrt(1 + (n + floor(1/2 + sqrt(n)))*A033317(n)^2). - Zak Seidov, Oct 24 2013
MAPLE
F:= proc(d) local r, Q; uses numtheory;
Q:= cfrac(sqrt(d), 'periodic', 'quotients'):
r:= nops(Q[2]);
if r::odd then
numer(cfrac([op(Q[1]), op(Q[2]), op(Q[2][1..-2])]))
else
numer(cfrac([op(Q[1]), op(Q[2][1..-2])]));
fi
end proc:
map(F, remove(issqr, [$1..100])); # Robert Israel, May 17 2015
MATHEMATICA
PellSolve[(m_Integer)?Positive] := Module[{cf, n, s}, cf = ContinuedFraction[Sqrt[m]]; n = Length[Last[cf]]; If[n == 0, Return[{}]]; If[OddQ[n], n = 2n]; s = FromContinuedFraction[ContinuedFraction[Sqrt[m], n]]; {Numerator[s], Denominator[s]}];
A033313 = DeleteCases[PellSolve /@ Range[100], {}][[All, 1]] (* Jean-François Alcover, Nov 21 2020, after N. J. A. Sloane in A002350 *)
Table[If[! IntegerQ[Sqrt[k]], {k, FindInstance[x^2 - k*y^2 == 1 && x > 0 && y > 0, {x, y}, Integers]}, Nothing], {k, 2, 80}][[All, 2, 1, 1, 2]] (* Horst H. Manninger, Mar 28 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Offset switched to 1 by R. J. Mathar, Sep 21 2009
Name corrected by Wolfdieter Lang, Sep 03 2015
STATUS
approved