anchor.diff:    (iterate (for-nested ((a :from 1 :below 100)
                           (b :from 1 :below 100)))
              (maximizing (funcall #'sum (digits (expt a b))))))
  +
  +(defun problem-57 ()
  +  ;; It is possible to show that the square root of two can be expressed as an
  +  ;; infinite continued fraction.
  +  ;;
  +  ;; √ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
  +  ;;
  +  ;; By expanding this for the first four iterations, we get:
  +  ;;
  +  ;; 1 + 1/2 = 3/2 = 1.5
  +  ;; 1 + 1/(2 + 1/2) = 7/5 = 1.4
  +  ;; 1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666...
  +  ;; 1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379...
  +  ;;
  +  ;; The next three expansions are 99/70, 239/169, and 577/408, but the eighth
  +  ;; expansion, 1393/985, is the first example where the number of digits in the
  +  ;; numerator exceeds the number of digits in the denominator.
  +  ;;
  +  ;; In the first one-thousand expansions, how many fractions contain
  +  ;; a numerator with more digits than denominator?
  +  (iterate
  +    (repeat 1000)
  +    (for i :initially 1/2 :then (/ (+ 2 i)))
  +    (for expansion = (1+ i))
  +    (counting (> (digits-length (numerator expansion))
  +                 (digits-length (denominator expansion))))))
  +
   
   (defun problem-74 ()
     ;; The number 145 is well known for the property that the sum of the factorial
  
positive.code:   ;; There are 120 reversible numbers below one-thousand.
    ;;
    ;; How many reversible numbers are there below one-billion (10^9)?
    (labels ((reverse-integer (n)
               (digits-to-number (nreverse (digits n))))
             (reversiblep (n)
               (let ((reversed (reverse-integer n)))
                 (values (unless (zerop (digit 0 n))
                           (every #'oddp (digits (+ n reversed))))
                         reversed))))
      (iterate
        ;; TODO: improve this one
        ;; (with limit = 1000000000) there are no 9-digit reversible numbers...
  
negative.code: (test p52 (is (= 142857 (problem-52))))
  (test p53 (is (= 4075 (problem-53))))
  (test p54 (is (= 376 (problem-54))))
  (test p55 (is (= 249 (problem-55))))
  (test p56 (is (= 972 (problem-56))))
  (test p57 (is (= 153 (problem-57))))
  
  (test p74 (is (= 402 (problem-74))))
  (test p145 (is (= 608720 (problem-145))))
  
  