s-99-34


Using previous coprime? solution

(define totient
  (lambda (x)
    (if (eq? x 1)
      '(1)
      (let loop ((temp x))
        (if (eq? temp 0)
          '()
          (if (coprime? temp x)
            (cons temp (loop (- temp 1)))
            (loop (- temp 1))))))))