Search found 2 matches
Search found 2 matches • Page 1 of 1
- Sun Mar 01, 2009 11:57 am
- Forum: Common Lisp
- Topic: Newb: help with factoring function
- Replies: 15
- Views: 12801
Hi! First post and lisp newbie ;) I had a go at writing a recurse version: (defun find-next-factor (n x) (if (zerop (rem n x)) x (find-next-factor n (+ x 1)))) (defun factors-rec (n) (labels ((rec (n acc) (let ((current-num (/ n (apply #'* acc)))) (if (= current-num 1) acc (rec n (cons (find-next-fa...