Recounting the Rationals: Twice!

  • Authors:
  • Roland Backhouse;João F. Ferreira

  • Affiliations:
  • School of Computer Science, University of Nottingham, Nottingham, England NG8 1BB;School of Computer Science, University of Nottingham, Nottingham, England NG8 1BB

  • Venue:
  • MPC '08 Proceedings of the 9th international conference on Mathematics of Program Construction
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

We derive an algorithm that enables the rationals to be efficiently enumerated in two different ways. One way is known and is credited to Moshe Newman; it corresponds to a deforestation of the so-called Calkin-Wilf tree of rationals. 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.