Skip to content

Instantly share code, notes, and snippets.

@bitdewy
Last active December 16, 2015 00:10
Show Gist options
  • Save bitdewy/5345930 to your computer and use it in GitHub Desktop.
Save bitdewy/5345930 to your computer and use it in GitHub Desktop.
Project Euler #3 in Common Lisp
;;;;
;;;; 3.lisp
;;;; ProjectEuler
;;;;
;;;; Created by bitdewy on 4/9/13.
;;;; Copyright (c) 2013 bitdewy. All rights reserved.
;;;;
;; Project Euler #3
(defun factorization (number)
(do ((sequence nil) (max (isqrt number)) (i 2 (+ 1 i)))
((or (> i number) (> i max)) sequence)
(do ()
((< 0 (mod number i)) sequence)
(setf number (/ number i))
(push i sequence))))
(first (factorization 600851475143))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment