(define factorize-scheme
(lambda (n)
(let loop ((n n)
(d 2)
(factors '()))
(if (< n 2)
(cons n factors)
(if (< d n)
(if (= (modulo n d) 0)
(loop (real->integer (/ n d))
d
(cons d factors))
(loop n
(if (= d 2)
(set! d 3)
(set! d (+ d 2)))
factors))
factors)))))