expressing fractions in factorial base
Given a fraction , one may re-express it in factorialbase as follows. For simplicity, we assume that thefraction is already written in lowest terms, i.e. that and have no common factor. As in the parent (http://planetmath.org/FactorialBaseRepresentationOfFractions)entry, we assume the both and are positive andthat , so our fraction is less than 1.
To begin, determine the smallest integer such that divides (http://planetmath.org/Divisibility) .
Rewrite the fraction with as denominator:
Successively split off terms as follows: given afraction , write where and then write
Initially, we choose and. At each successive repetition of theprocedure, set to be the value of fromthe previous step and decrease by 1.
Let us illustrate this with an example. Wewill rewrite in factorial base. Lookingat factorials, we see that does not divideeither or , but it does divide ,so we have .
Next we rewrite the fraction with asdenominator. Since and ,we should multiply both numerator and denominatorof our fraction by to obtain .
Now, we split off terms. We have , so
Next, , so
Since , we are done. Thus, we see that thefactorial base representation of is as in the table in theparent entry.
We can make the calculation more concise by notingthat the splitting off of terms can also be describedas follows: the factorial base representation of is the factorial base representation of followed by , where as above. For example, let us compute thefactorial base representation of using thistrick. Looking at factorials, we see that .We express our fraction with a denominator of :
We now split of digits like follows:
Hence, we see that the factorial base representationof is .
The following LISP program computes factorial baserepresentations of rational numbers using this method.It was used to compute the table of factorial baserepresentations in the parent entry.
(defun factorial) (n)
(cond ((= n 0) 1)
(t (* n (factorial (- n 1))))))
(defun d-tilde (n m)
(cond ((= (% (factorial m) n) 0) m)
(t (d-tilde n (+ m 1)))))
(defun d (n) (d-tilde n 1))
(defun s (p q)
(cond ((= q 1) nil)
(t (append
(s (/ p q) (- q 1))
(list (% p q))))))
(defun r (p q) (s
(* p (/ (f (d q)) q))
(d q)))
Since LISP can look rather confusing to someone who is not familiarwith its notational conventions — all functions are written asprefixes and parentheses are used a bit differently than usually,a translation into more typical mathematical notation may be helpful.To do this, let us define a few symbols. Let ‘’ denote theconcatenaton of tuplets — given an -tuplet and an -tuplet , we set to be the-tuplet .Let “” denote the integer part of and let“ denote the remainder of dividing by . Forinstance, and . With these notationalconventions, we may re-express our program as follows: