OFFSET
1,6
REFERENCES
A. Cayley, Report of a committee appointed for the purpose of carrying on the tables connected with the Pellian equation ..., Collected Mathematical Papers. Vols. 1-13, Cambridge Univ. Press, London, 1889-1897, Vol. 13, pp. 430-443.
C. F. Degen, Canon Pellianus. Hafniae, Copenhagen, 1817.
D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 55.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n=1..10000
A. Cayley, Report of a committee appointed for the purpose of carrying on the tables connected with the Pellian equation ..., Collected Mathematical Papers. Vols. 1-13, Cambridge Univ. Press, London, 1889-1897, Vol. 13, pp. 430-443. (Annotated scanned copy)
M. Zuker, Fundamental solution to Pell's Equation x^2 - d*y^2 = +-1 [Broken link]
MATHEMATICA
r[x_, n_] := Reduce[ y > 0 && (x^2 - n*y^2 == -1 || x^2 - n*y^2 == 1 ), y, Integers]; a[n_ /; IntegerQ[ Sqrt[n]]] = 0; a[n_] := a[n] = (k = 1; While[r[k, n] === False, k++]; y /. ToRules[r[k, n]]); Table[ Print[ a[n] ]; a[n], {n, 1, 79}] (* Jean-François Alcover, Jan 30 2012 *)
nmax = 500;
nconv = 200; (* The number of convergents'nconv' should be increased if the linear recurrence is not found for some terms. *)
x[n_] := x[n] = Module[{lr}, If[IntegerQ[Sqrt[n]], 1, lr = FindLinearRecurrence[ Numerator[ Convergents[Sqrt[n], nconv]]]; SelectFirst[lr, # > 1 &]/2]];
a[n_] := If[n == 2, 1, SelectFirst[{Sqrt[(x[n]^2 - 1)/n], Sqrt[(x[n]^2 + 1)/n]}, IntegerQ]];
Array[a, nmax] // Quiet (* Jean-François Alcover, Mar 08 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Corrected and extended by T. D. Noe, May 19 2007
STATUS
approved