OFFSET
0,3
COMMENTS
The continued fraction expansion of sqrt(n) is periodic, and the maximal element is the last element in the period, 2*floor(sqrt(n)).
LINKS
Oskar Perron, Die Lehre von den Kettenbrüchen, B. G. Teubner (1913), section 24, p. 87.
FORMULA
MATHEMATICA
{0} ~Join~ Table[2 Mod[Floor@ Sqrt@ n, Ceiling@ Sqrt@ n], {n, 100}] (* Giovanni Resta, Jun 29 2019 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Karl Fischer, Jun 19 2019
EXTENSIONS
More terms from Giovanni Resta, Jun 29 2019
STATUS
approved