

A308720


The maximum value in the continued fraction of sqrt(n), or 0 if there is no fractional part.


0



0, 0, 2, 2, 0, 4, 4, 4, 4, 0, 6, 6, 6, 6, 6, 6, 0, 8, 8, 8, 8, 8, 8, 8, 8, 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 16, 16, 16, 16, 16, 16, 16
(list;
graph;
refs;
listen;
history;
text;
internal format)



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

Table of n, a(n) for n=0..71.
Oskar Perron, Die Lehre von den Kettenbrüchen, B. G. Teubner (1913), section 24, p. 87.


FORMULA

a(k^2) = 0.
a(m) = floor(sqrt(m)) for nonsquare m.
a(n) = 2 * A320471(n) for n > 0.


MATHEMATICA

{0} ~Join~ Table[2 Mod[Floor@ Sqrt@ n, Ceiling@ Sqrt@ n], {n, 100}] (* Giovanni Resta, Jun 29 2019 *)


CROSSREFS

Cf. A000196, A003285, A096494.
Sequence in context: A073469 A307076 A342472 * A086882 A341415 A328141
Adjacent sequences: A308717 A308718 A308719 * A308721 A308722 A308723


KEYWORD

nonn,easy


AUTHOR

Karl Fischer, Jun 19 2019


EXTENSIONS

More terms from Giovanni Resta, Jun 29 2019


STATUS

approved



