(define (prime-factors x) (if (= x 1) '() (let loop ((temp x) (current 2)) (if (= temp 1) '() (if (and (= (modulo temp current) 0) (prime? current)) (cons current (loop (quotient temp current) 2)) (loop temp (+ current 1)))))))