diff options
Diffstat (limited to '0003/main.lisp')
| -rw-r--r-- | 0003/main.lisp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/0003/main.lisp b/0003/main.lisp new file mode 100644 index 0000000..b2ba414 --- /dev/null +++ b/0003/main.lisp @@ -0,0 +1,16 @@ +(defun my-reduce (x y) + (if (= 0 (mod x y)) + (my-reduce (/ x y) y) + x)) + +(defun max-factor-impl (x cur) + (let ((next-x (my-reduce x cur))) + (if (= 1 next-x) + cur + (max-factor-impl next-x (+ 1 cur))))) + +(defun max-factor (x) + (max-factor-impl x 2)) + +(format t "~&~S~%" (max-factor 600851475143)) + |
