Let

,

. The continued fraction of

is either finite (when

is a perfect square so that

is rational) or eventually periodic (when

is not a perfect square so that

is irrational).

If

is rational, the elements of its continued fraction are plotted.

If

is irrational, let its continued faction be

, where the repeating part under the bar starts as soon as possible. In that case, the plot is of the repeating part

, with the initial elements

ignored.

Sometimes

is a palindrome; that is,

is the same read from right to left as from left to right,

, and its graph is symmetric. Often

is the concatenation of two palindromes, like

. If

is rational and not a perfect square, then

; that is,

is a palindrome concatenated with twice the integer part of

, which is a trivial palindrome. Finally, there are cases where

is not a palindrome. Colors distinguish the various cases.

The continued fraction is shown under the plot in the

*Mathematica* notation

.