Skip to content

Commit

Permalink
Risolto problema 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Giacomo Ritucci committed Jul 15, 2008
1 parent f734843 commit e0f94a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 03.lisp
@@ -1,7 +1,14 @@
;;;; Giacomo Ritucci, 23.07 di venerdì 14 dicembre 2007
;;;; Giacomo Ritucci, 02.03 di martedì 15 luglio 2008

;;; Problem 3
;;;
;;; The prime factors of 13195 are 5, 7, 13 and 29.
;;;
;;; What is the largest prime factor of the number 317584931803?

(defun largest-prime-factor (n &optional (i 2))
(cond ((= n i) n)
((= 0 (mod n i)) (largest-prime-factor (/ n i) i))
(T (largest-prime-factor n (incf i)))))

(largest-prime-factor 600851475143)

0 comments on commit e0f94a3

Please sign in to comment.