# Proposal: Digit Strings which Represent Continued Fractions

This article is a proposed description of a means by which to express numbers in a generalized continued fraction format as represented by a string of digits. It will not discuss other notations for continued fractions. By way of analogy, the subject matter of this article would be similar to a description of the decimal system (base) and will not touch on subject matter which is similar to means of expressing numbers as summations (big operator "${\displaystyle \sum }$") or formal polynomials in ${\displaystyle 10}$ with coefficients in ${\displaystyle \mathbb {Z} \cap [0,9]}$, even though all of these are mutually equivalent.

For the purposes of this article: All expressions are big-endian and microdigits are in traditional decimal. PEMDAS is obeyed.

## Original Explanation

Let ${\displaystyle z=a_{0}+b_{0}/(a_{1}+b_{1}/(a_{2}+b_{2}/(\dots )))=a_{0}+{\underset {i=0}{\overset {\infty }{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}}$, where ${\displaystyle a_{i}}$ and ${\displaystyle b_{i}}$ are integers for all ${\displaystyle i}$ (see Kettenbruch notation here). In fact, for all i, we will canonically restrict ${\displaystyle a_{(i+1)}}$ and ${\displaystyle b_{i}}$ to nonnegative integers such that if ${\displaystyle b_{j}=0}$, then ${\displaystyle a_{k}=1}$ and ${\displaystyle b_{k}=0}$ for all ${\displaystyle k\geq j}$; this is a perfectly natural and standard set of restrictions to make and does not actually diminish the set of numbers which are expressible in this format, but the restriction is not technically necessary for Lojban. Then we will denote ${\displaystyle z}$ by the continued fraction representation ${\displaystyle z=(a_{0}:b_{0},a_{1}:b_{1},a_{2}:b_{2},\dots )}$; the whole rhs representation is called a string. Notice that the integer part is included. In this format, for each ${\displaystyle i}$, "${\displaystyle a_{i}:b_{i}}$" forms a single unit called a macrodigit; for each ${\displaystyle i}$, "${\displaystyle a_{i}}$" and "${\displaystyle b_{i}}$" each are microdigits; the colon ("${\displaystyle :}$") separates microdigits and the comma ("${\displaystyle ,}$") separates macrodigits. Microdigits can be expressed in any base or other representation and macrodigits could be reversed or slightly rearranged (such as being of form "${\displaystyle b_{i}:a_{(i+1)}}$"; however, for our purposes here microdigits will be expressed in big-endian traditional decimal and macrodigits will be formed and ordered as shown; the specification herein proposed will obligate the user to express the macrodigits in the form which is shown (id est: of form "${\displaystyle a_{i}:b_{i}}$"; within any given macrodigit, the first microdigit expressed represents ${\displaystyle a_{i}}$ and the second (and final) microdigit expressed represents ${\displaystyle b_{i}}$, only) but the other features aforementioned are not guaranteed, although they may normally be assumed as a contextless default. In order to be clear: in this representation, each macrodigit will consist of exactly two microdigits - namely, ${\displaystyle a_{i}}$ and ${\displaystyle b_{i}}$ in that order, for all ${\displaystyle i}$ - and these microdigits will be separated explicitly by "pi'e"; meanwhile, macrodigits will be separated explicitly by "pi". In this representation, I will denote a not-explicitly-specified microdigit by a pair of consecutive underscores ("${\displaystyle \_\_}$"). In the 'big-endian' arrangement of the macrodigits (as herein depicted), the first microdigit (${\displaystyle a_{0}}$) represents the 'integer part' of the expression.

In this system, let "pi'e" represent ":" and let "pi" represent ",", each bijectively. Then the basic method of expressing a continued fraction is to just read ${\displaystyle (a_{0}:b_{0},a_{1}:b_{1},a_{2}:b_{2},\dots )}$ where each microdigit is expressed in some base which represents integers, the parenthesis are not mentioned, the separators being named/pronounced as before, "ra'e" being used in order to create cyclic patterns or to extend the string indefinitely, and the string being terminated as any numeral string could or would be. The interpretation of the whole string according to these rules for continued fractions would be specified via JUhAU.

A string terminates if and only if "ra'e" is not explicitly used. "ra'e" will couple with exactly one microdigit, and exactly every following explicitly mentioned microdigit in that position of their macrodigits will be considered to be part of a repetitious sequence applying to/running over the microdigits in that position of their macrodigits; the other microdigit is unaffected by it. Moreover, it can couple with "pi'e" as well (see below), but this occurs iff "ra'e" is explicitly mentioned immediately prior to exactly an explicitly mentioned "pi'e". If it couples with ${\displaystyle a_{j}}$ for some ${\displaystyle j}$, then it will cyclically repeat that ${\displaystyle a_{j}}$ and all explicitly mentioned ${\displaystyle a_{(j+k)}}$ for all ${\displaystyle k>0}$ in each ${\displaystyle a_{i}}$ spot until the last ${\displaystyle b_{i}}$ (which either will be explicitly mentioned and defined as last by the closure of the string scope (formally, all subsequent ${\displaystyle b_{i}}$ will be trivial), or will be nonexistent according to the next point); iff it couples with ${\displaystyle b_{j}}$ for some ${\displaystyle j}$, then the string is extended to infinite length and there exists no 'last ${\displaystyle b_{i}}$' (meaning that any repetition on ${\displaystyle a_{i}}$ will also continue ad infinitum). Thus, ${\displaystyle (a_{0}:b_{0},a_{1}:b_{1},\operatorname {ra'e} a_{2}:b_{2},a_{3}:b_{3},\_\_:b_{4},\_\_:b_{5},\_\_:b_{6},\dots ,\_\_:b_{10},\_\_:\operatorname {ra'e} b_{11})=(a_{0}:b_{0},a_{1}:b_{1},a_{2}:b_{2},a_{3}:b_{3},a_{2}:b_{4},a_{3}:b_{5},a_{2}:b_{6},a_{3}:b_{7},a_{2}:b_{8},a_{3}:b_{9},a_{2}:b_{10},a_{3}:b_{11},a_{2}:b_{11},a_{3}:b_{11},a_{2}:b_{11},a_{3}:b_{11},a_{2}:b_{11},\dots )}$.

• For any ${\displaystyle i}$, if ${\displaystyle a_{i}}$ is not explicitly mentioned, then it is assumed to take on the appropriate value according to an ongoing formula which applies to it (such as by "ra'e") or, otherwise, it defaults to ${\displaystyle 1}$. These are called "context-dependent defaults".
• For any ${\displaystyle i}$, if ${\displaystyle b_{i}}$ is not explicitly mentioned, then it is assumed to take on the appropriate value according to an ongoing formula which applies to it (such as by "ra'e") or, otherwise, it defaults to ${\displaystyle 1}$ if the string continues (explicitly or by sufficient "ra'e") and ${\displaystyle 0}$ otherwise. This is especially true if the verbal expression of the string is terminated and "ra'e" was not explicitly used (on ${\displaystyle b_{j}}$ for some ${\displaystyle j}$): all finite strings can infinitely extended by right-concatenating "${\displaystyle 1:0,1:0,1:0,\dots )}$ to them (this is similar to decimal notation; for example: ${\displaystyle 8.23=8.23000\dots }$). These are called "context-dependent defaults".
• If exactly one microdigit is explicitly mentioned in a given macrodigit, then: it is to be understood to be ${\displaystyle a_{i}}$ iff "ra'e" did not couple with "pi'e"; regardless of the prior presence of "ra'e pi'e" in the string, the implicit microdigit will assume the generic default value or (preferably) the value according to a repetition or formula which it inherited (see the aforementioned context-dependent defaults).

Even though the basic and assumed notation for ${\displaystyle a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}}$ is ${\displaystyle (a_{0}:b_{0},a_{1}:b_{1},a_{2}:b_{2},a_{3}:b_{3},\dots )}$ (this is so-called 'big-endian' in the macrodigits), other formats can be supported iff they are explicitly specified. For example, with a change of endianness in the macrodigits, ${\displaystyle a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}=(\dots ,a_{3}:b_{3},a_{2}:b_{2},a_{1}:b_{1},a_{0}:b_{0})}$. It is also reasonable that the microdigits could be reordered (note that this is not a change in the endianness of each microdigit (which would change ${\displaystyle 12:34}$ to ${\displaystyle 21:43}$); rather, it is a transposition of the microdigits within each macrodigit) like so: ${\displaystyle a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}=(\dots ,b_{3}:a_{3},b_{2}:a_{2},b_{1}:a_{1},b_{0}:a_{0})}$; notice that in this example, I also changed the endianness of the macrodigits because the expression does not make much intuitive sense otherwise (but it would nonetheless be possible to do merely one of these changes in isolation, even if it is not advisable or sensical).

The string will terminate and be interpreted as a number formed from the specified continued fraction as all other digits strings do (see my other work).

-- Krtisfranks (talk) 08:10, 9 March 2018 (UTC)

## Alternative Explanation

The description in this section is intended to provide the same results as those in the "Original Explanation" section.

Zeroth, the mode must be activated (as described previously).

### Step 1: Simplest (and Finite) Case

Let ${\displaystyle n\in \mathbb {N} \cup \{0\}}$. Consider the continued fraction ${\displaystyle a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}}$, where ${\displaystyle \forall i,a_{i}}$ & ${\displaystyle b_{i}}$ will be explicitly defined, particularly as they arise. We can enforce conditions on the sequences ${\displaystyle (a_{i})_{i}}$ & ${\displaystyle (b_{i})_{i}}$, but we will ignore such details, because we just need formal continued fractions.