OFFSET
0,3
COMMENTS
The Everest et al. link states that "the continued fraction expansion of a quadratic irrational is eventually periodic, which implies that the numerators px and denominators qx of its convergents satisfy linear recurrence relations".
Let k be the period length minus one of the continued fraction of sqrt(n). Then the linear recurrence signatures with constant coefficients have the form (0, 0, ..., 0, a(n), 0, 0, ..., 0, (-1)^(n+1)), with k zeroes before and behind a(n).
a(n) is twice the numerator of the convergent to sqrt(n) with index k (starting with 0).
These properties result from the mirrored structure of the period of such continued fractions.
LINKS
Jean-François Alcover, Table of n, a(n) for n = 0..10000
Graham Everest, Alf van der Poorten, Igor Shparlinski, and Thomas Ward, Recurrence Sequences, AMS Mathematical Surveys and Monographs, Volume 104 (2003) p. 8, 5th paragraph.
FORMULA
a(n) = 2*A006702(n) if n is not square, otherwise 0.
EXAMPLE
CROSSREFS
KEYWORD
nonn
AUTHOR
Georg Fischer, Feb 22 2021
STATUS
approved