a0f494350896

Add comments with the Project Euler problem text
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 10 Apr 2016 00:58:30 +0000
parents 8d552510fe9d
children 5dc80bffbecc
branches/tags (none)
files euler.lisp

Changes

diff -r 8d552510fe9d -r a0f494350896 euler.lisp
--- a/euler.lisp	Sat Apr 09 17:16:13 2016 +0000
+++ b/euler.lisp	Sun Apr 10 00:58:30 2016 +0000
@@ -1,12 +1,23 @@
 (in-package #:euler)
 
 (defun problem-1 ()
+  ;; If we list all the natural numbers below 10 that are multiples of 3 or 5,
+  ;; we get 3, 5, 6 and 9. The sum of these multiples is 23.
+  ;;
+  ;; Find the sum of all the multiples of 3 or 5 below 1000.
   (loop :for i :from 1 :below 1000
         :when (or (dividesp i 3)
                   (dividesp i 5))
         :sum i))
 
 (defun problem-2 ()
+  ;; Each new term in the Fibonacci sequence is generated by adding the previous
+  ;; two terms. By starting with 1 and 2, the first 10 terms will be:
+  ;;
+  ;;     1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
+  ;;
+  ;; By considering the terms in the Fibonacci sequence whose values do not
+  ;; exceed four million, find the sum of the even-valued terms.
   (loop :with p = 0
         :with n = 1
         :while (<= n 4000000)
@@ -15,4 +26,7 @@
                    n (+ p n))))
 
 (defun problem-3 ()
+  ;; The prime factors of 13195 are 5, 7, 13 and 29.
+  ;;
+  ;; What is the largest prime factor of the number 600851475143 ?
   (apply #'max (prime-factorization 600851475143)))