# Proposal: Digit Strings which Represent Continued Fractions

This page contains discussions of experimental/scientific/philosophical/logical aspects of Lojban that arenon-official and not for everyday usage. You've been warned. |

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 "<math>\sum</math>") or formal polynomials in <math>10</math> with coefficients in <math>\mathbb{Z} \cap [0,9]</math>, 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 <math>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)</math>, where <math>a_i</math> and <math>b_i</math> are integers for all <math>i</math> (see https://oeis.org/wiki/Continued_fractions#Gauss.27_Kettenbruch_notation ). In fact, for all i, we will canonically restrict <math>a_{(i+1)}</math> and <math>b_i</math> to nonnegative integers such that if <math>b_j = 0</math>, then <math>a_k = 1</math> and <math>b_k = 0</math> for all <math>k \geq j</math>; 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 <math>z</math> by the continued fraction representation <math>z = (a_0 : b_0, a_1 : b_1, a_2 : b_2, \dots)</math>; the whole rhs representation is called a string. Notice that the integer part is included. In this format, for each <math>i</math>, "<math>a_i : b_i</math>" forms a single unit called a macrodigit; for each <math>i</math>, "<math>a_i</math>" and "<math>b_i</math>" each are microdigits; the colon ("<math>:</math>") separates microdigits and the comma ("<math>,</math>") 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 "<math>b_i : a_{(i+1)}</math>"; 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 "<math>a_i : b_i</math>"; within any given macrodigit, the first microdigit expressed represents <math>a_i</math> and the second (and final) microdigit expressed represents <math>b_i</math>, 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, <math>a_i</math> and <math>b_i</math> in that order, for all <math>i</math> - 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 ("<math>\_\_</math>"). In the 'big-endian' arrangement of the macrodigits (as herein depicted), the first microdigit (<math>a_0</math>) 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 <math>(a_0 : b_0, a_1 : b_1, a_2 : b_2, \dots)</math> 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 <math>a_j</math> for some <math>j</math>, then it will cyclically repeat that <math>a_j</math> and all explicitly mentioned <math>a_{(j+k)}</math> for all <math>k>0</math> in each <math>a_i</math> spot until the last <math>b_i</math> (which either will be explicitly mentioned and defined as last by the closure of the string scope (formally, all subsequent <math>b_i</math> will be trivial), or will be nonexistent according to the next point); iff it couples with <math>b_j</math> for some <math>j</math>, then the string is extended to infinite length and there exists no 'last <math>b_i</math>' (meaning that any repetition on <math>a_i</math> will also continue ad infinitum). Thus, <math>(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)</math>.

Additional rules:

- For any <math>i</math>, if <math>a_i</math> 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 <math>1</math>. These are called "context-dependent defaults".
- For any <math>i</math>, if <math>b_i</math> 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 <math>1</math> if the string continues (explicitly or by sufficient "ra'e") and <math>0</math> otherwise. This is especially true if the verbal expression of the string is terminated and "ra'e" was not explicitly used (on <math>b_j</math> for some <math>j</math>): all finite strings can infinitely extended by right-concatenating "<math>1:0, 1:0, 1:0, \dots)</math> to them (this is similar to decimal notation; for example: <math>8.23 = 8.23000\dots</math>). 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 <math>a_i</math> 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 <math>a_0 + \underset{i=0}{\overset{n}{\mathrm K}} \big(\frac{b_i}{a_{i+1}}\big)</math> is <math>(a_0:b_0, a_1:b_1, a_2:b_2, a_3:b_3, \dots)</math> (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, <math>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)</math>. 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 <math>12:34</math> to <math>21:43</math>); rather, it is a transposition of the microdigits within each macrodigit) like so: <math>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)</math>; 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.