rational number

Ferreira JF, Mendes A.  2015.  A calculational approach to path-based properties of the Eisenstein–Stern and Stern–Brocot trees via matrix algebra. Journal of Logical and Algebraic Methods in Programming. Abstract2015-ferreiramendes-calcpathbased-final.pdf

This paper proposes a calculational approach to prove properties of two well-known binary trees used to enumerate the rational numbers: the Stern–Brocot tree and the Eisenstein–Stern tree (also known as Calkin–Wilf tree). The calculational style of reasoning is enabled by a matrix formulation that is well-suited to naturally formulate path-based properties, since it provides a natural way to refer to paths in the trees.

Three new properties are presented. First, we show that nodes with palindromic paths contain the same rational in both the Stern–Brocot and Eisenstein–Stern trees. Second, we show how certain numerators and denominators in these trees can be written as the sum of two squares x2 and y2, with the rational View the MathML source appearing in specific paths. Finally, we show how we can construct Sierpiński's triangle from these trees of rationals.

Backhouse R, Ferreira JF.  2011.  On Euclid's Algorithm and Elementary Number Theory. Science of Computer Programming. 76(3):160-180. Abstract2011-oneuclidsalgorithm.pdf

Algorithms can be used to prove and to discover new theorems. This paper shows how algorithmic skills in general, and the notion of invariance in particular, can be used to derive many results from Euclid’s algorithm. We illustrate how to use the algorithm as a verification interface (i.e., how to verify theorems) and as a construction interface (i.e., how to investigate and derive new theorems). The theorems that we verify are well-known and most of them are included in standard number-theory books. The new results concern distributivity properties of the greatest common divisor and a new algorithm for efficiently enumerating the positive rationals in two different ways. One way is known and is due to Moshe Newman. The second is new and corresponds to a deforestation of the Stern-Brocot tree of rationals. We show that both enumerations stem from the same simple algorithm. In this way, we construct a Stern-Brocot enumeration algorithm with the same time and space complexity as Newman’s algorithm. A short review of the original papers by Stern and Brocot is also included.