Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

9 lines (9 sloc) 0.25 kB
(defun largest-prime-factor (n)
(labels ((rec (num acc)
(cond ((= 1 num) acc)
((<= num 2) num)
(t (let ((fac (do ((i 2 (1+ i)))
((or (>= i num)
(zerop (mod num i))) i))))
(rec (/ num fac) fac))))))
(rec n 1)))
Jump to Line
Something went wrong with that request. Please try again.