This link is class room explanation behind all the math without dumbing anything down. Here's the original amazing paper by virtue of simplicity and elegance. The only things needed to understand it is the most rudimentary understanding of binary trees and Euclid’s gcd algorithm.
I wrote up some scheme code to print out the "parents" of the node, which allows one to assign a unique positive integer to every/any Rational.
;Tree
(define (display-all . args) (display args))
(define (p-parents m n)
(cond ((or (zero? m) (zero? n)))
((= m n) (display-all 1 "\n") 1)
((< m n) (display-all m " " n "\n")(p-parents m (- n m)))
((> m n) (display-all m " " n "\n")(p-parents (- m n) n))))
;Print the parent nodes of 49/19
(p-parents 49 19)
No comments:
Post a Comment