(define (leftmost-digit base n)
(if (< n base)
n
(let ((leftmost-pair (leftmost-digit (* base base) n)))
(if (< leftmost-pair base)
leftmost-pair
(quotient leftmost-pair base)))))The puzzle is to adapt this code to return the position of the leftmost digit.(leftmost-digit+ 10 46729885) would return two values, 4 and 7
No comments:
Post a Comment