# Proposal: Digit Strings which Represent Continued Fractions

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 "$\sum$ ") or formal polynomials in $10$ with coefficients in $\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 $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 $a_{i}$ and $b_{i}$ are integers for all $i$ (see Kettenbruch notation here). In fact, for all i, we will canonically restrict $a_{(i+1)}$ and $b_{i}$ to nonnegative integers such that if $b_{j}=0$ , then $a_{k}=1$ and $b_{k}=0$ for all $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 $z$ by the continued fraction representation $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 $i$ , "$a_{i}:b_{i}$ " forms a single unit called a macrodigit; for each $i$ , "$a_{i}$ " and "$b_{i}$ " each are microdigits; the colon ("$:$ ") separates microdigits and the comma ("$,$ ") 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 "$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 "$a_{i}:b_{i}$ "; within any given macrodigit, the first microdigit expressed represents $a_{i}$ and the second (and final) microdigit expressed represents $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, $a_{i}$ and $b_{i}$ in that order, for all $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 ("$\_\_$ "). In the 'big-endian' arrangement of the macrodigits (as herein depicted), the first microdigit ($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 $(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 $a_{j}$ for some $j$ , then it will cyclically repeat that $a_{j}$ and all explicitly mentioned $a_{(j+k)}$ for all $k>0$ in each $a_{i}$ spot until the last $b_{i}$ (which either will be explicitly mentioned and defined as last by the closure of the string scope (formally, all subsequent $b_{i}$ will be trivial), or will be nonexistent according to the next point); iff it couples with $b_{j}$ for some $j$ , then the string is extended to infinite length and there exists no 'last $b_{i}$ ' (meaning that any repetition on $a_{i}$ will also continue ad infinitum). Thus, $(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 $i>0$ , if $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 $1$ . $a_{0}=0$ if it is not explicitly mentioned unless context very clearly indicates otherwise. These are called "context-dependent defaults".
• For any $i$ , if $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 $1$ if the string continues (explicitly or by sufficient "ra'e") and $0$ otherwise. This is especially true if the verbal expression of the string is terminated and "ra'e" was not explicitly used (on $b_{j}$ for some $j$ ): all finite strings can infinitely extended by right-concatenating "$1:0,1:0,1:0,\dots )$ to them (this is similar to decimal notation; for example: $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 $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 $a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}$ is $(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, $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 $12:34$ to $21:43$ ); rather, it is a transposition of the microdigits within each macrodigit) like so: $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).

Throughout the following discussions, I shall assume that such mode activation has been performed as appropriate.

For some $n\in \mathbb {N} \cup \{0,+\infty \}$ and some sequences $(a_{i})_{i},(b_{i})_{i}$ , we will map $z=a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}$ (math form) to a string of form $(a_{0}:b_{0},a_{1}:b_{1},a_{2}:b_{2},\dots ,a_{n}:b_{n})$ (this is the notational form), which would be pronounced more or less as "a0 pi'e b0 pi a1 pi'e b1 pi a2 pi'e b2 pi ... an pi'e bn" (this is the verbal form). In other words, each ":" in the notational form is expressed as "pi'e" and each "," in the notational form is expressed as "pi", and vice-versa, where "pi'e" and "pi" are exactly the cmavo that you think that they are. Notice that the parenthesis in the notation form are not pronounced; they are used in the notational form so that readers understand that everything between them forms some sort of unit - however, in Lojban, the terms are read and first understood as digits which compile into some sort of numeric string, so this is not necessary; moreover, mode activation makes it clear that they are indeed a single unit (and what that unit means: namely, a continued fraction).

(Technical aside: In the original math form, each ai and bi are terms in their respective sequences and can be more or less understood as indirect terms in the continued fraction (really, the ordered pairs are the operands of the K operator and the entries of the pairs are the terms of the sequences); we are performing an implicit sleight of hand in mapping these numbers to digits in the string form, and we notate them exactly the same. This latter fact can be seen if one realizes the "pi'e" and "pi" are themselves digits and can only be concatenated to other digits. So, I may end up using the words "term" and "digit" more or less interchangeably (making the assumption that the reader knows when I am not including "pi'e" and "pi" in my reference set); they are technically distinct in concept and domain, but they are isomorphic. For the record, each 'term' in string notation may actually be constituted by more than one 'digit' in the expansion; for example, a0 = 3*4 would mean that the expression "a0" in the string would have to be represented by the multidigit expression "12" in decimal notation. Technically, I would call "ai" and "ab" macrodigits (and "12", standing in for such a macrodigit, is itself a macrodigit) and these can be composed of microdigits (which, in the example, would be "1" and "2" in that order). I will assume that microdigits are to be interpreted in decimal form (so a "1" followed by a "2", and nothing else being involved, compiles to "12" and means the number twelve) throughout this page; this assumption can be changed by certain cmavo if so desired.)

Now, it might be nice to avoid having to talk forever in the case of $n=+\infty$ or to not have to say or repeat digits that follow a pattern. The following sections address these concerns. However, we first must cover the simplest cases - at the very least because they serve as good entry-level examples.

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

Let $n\in \mathbb {N} \cup \{0\}$ . Consider the continued fraction $z=a_{0}+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {b_{i}}{a_{i+1}}}{\big )}$ , where $\forall i,a_{i}$ & $b_{i}$ will be explicitly defined, particularly as they arise. We can enforce conditions on the sequences $(a_{i})_{i}$ & $(b_{i})_{i}$ , but we will ignore such details, because we just need formal continued fractions. Since n is finite, we will not use the word "ra'e" on any of the bi terms in this case/section.

We can transform the representation of $z$ from the previous notation (which is the application of a mathematical operator) to a string of digits. This is similar to changing "2*5" to "10".

The simplest subcase is if $b_{i}=0\forall i$ . In that subcase, z = a0. In string form, z would be written as "(a0:0, 0:0, 0:0, ...)", which collapses to "(a0)". Since we are assuming that n is finite and that we are explicitly stating the value of any nontrivial term (ai and bi), we take the sequence to 'terminate' with the last explicitly mentioned term (and all subsequent terms to be trivial - which is to say that they need not be mentioned). In particular, if the last explicitly mentioned term is ai, then bi = 0; if the last explicitly mentioned term is bi, then a(i+1) = 1 and b(i+1) = 0; these particular values are 'trivial'. It does not matter what the later terms in the sequences are due to the nature of fractions (so long as we do not divide by zero - which we shall assume). Note that explicitly mentioned terms need not be nontrivial; however, if the last explicitly mentioned term was trivial, then the expression could have been simplified by having not explicitly mentioned it either. In the string representation, only the explicitly mentioned terms need be shown/said (and simplifications such as the one just stated are always welcome); in other words, we do not need to say any later ai or bi or - indeed - even the "pi" (",") immediately after the last explicitly mentioned term. We also introduce the rule - used throughout this page - that (unless a certain condition is satisfied, which shall be addressed later), if exactly one macrodigit is explicitly mentioned between "pi"s, then it represents ai (for appropriate i). Thus "(a0)" is pronounced simply as "a0", whatever that is. In that situation, the bi with which it is paired will take the default value - in this example, 0. For example, the extremely trivial continued fraction 12 (twelve), which equals $12+{\underset {i=0}{\overset {n}{\mathrm {K} }}}{\big (}{\frac {0}{a_{i+1}}}{\big )}$ for any sequence $(a_{i})_{i}:a_{0}=12\&a_{i}\neq 0\forall i$ , is pronounced simply as "pa re" (assuming that continued fraction interpretation has been activated and microdigits are expressed in decimal notation).