# "Write a function that computes the sum of all proper divisors of a given number lisp" Code Answer's

You're definitely familiar with the best coding language Lisp that developers use to develop their projects and they get all their queries like "Write a function that computes the sum of all proper divisors of a given number lisp" answered properly. Developers are finding an appropriate answer about Write a function that computes the sum of all proper divisors of a given number lisp related to the Lisp coding language. By visiting this online portal developers get answers concerning Lisp codes question like Write a function that computes the sum of all proper divisors of a given number lisp. Enter your desired code related query in the search bar and get every piece of information about Lisp code related question on Write a function that computes the sum of all proper divisors of a given number lisp.

### Write a function that computes the sum of all proper divisors of a given number lisp

By Yawning Yak on Mar 05, 2020
``(defun proper-divisors-recursive (product &optional (results '(1)))   "(int,list)->list::Function to find all proper divisors of a +ve integer."    (defun smallest-divisor (x)      "int->int::Find the smallest divisor of an integer > 1."      (if (evenp x) 2          (do ((lim (truncate (sqrt x)))               (sd 3 (+ sd 2)))              ((or (integerp (/ x sd)) (> sd lim)) (if (> sd lim) x sd)))))    (defun pd-rec (fac)      "(int,int)->nil::Recursive function to find proper divisors of a +ve integer"      (when (not (member fac results))         (push fac results)         (let ((hifac (/ fac (smallest-divisor fac))))            (pd-rec hifac)            (pd-rec (/ product hifac)))))    (pd-rec product)   (butlast (sort (copy-list results) #'<))) (defun task (method &optional (n 1) (most-pds '(0)))   (dotimes (i 19999)      (let ((npds (length (funcall method (incf n))))            (hiest (car most-pds)))         (when (>= npds hiest)            (if (> npds hiest)                (setf most-pds (list npds (list n)))                (setf most-pds (list npds (cons n (second most-pds))))))))   most-pds) (defun main ()   (format t "Task 1:Proper Divisors of [1,10]:~%")   (dotimes (i 10) (format t "~A:~A~%" (1+ i) (proper-divisors-recursive (1+ i))))   (format t "Task 2:Count & list of numbers <=20,000 with the most Proper Divisors:~%~A~%"           (task #'proper-divisors-recursive)))``

Source: rosettacode.org

0

All those coders who are working on the Lisp based application and are stuck on Write a function that computes the sum of all proper divisors of a given number lisp can get a collection of related answers to their query. Programmers need to enter their query on Write a function that computes the sum of all proper divisors of a given number lisp related to Lisp code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Write a function that computes the sum of all proper divisors of a given number lisp for the programmers working on Lisp code while coding their module. Coders are also allowed to rectify already present answers of Write a function that computes the sum of all proper divisors of a given number lisp while working on the Lisp language code. Developers can add up suggestions if they deem fit any other answer relating to "Write a function that computes the sum of all proper divisors of a given number lisp". Visit this developer's friendly online web community, CodeProZone, and get your queries like Write a function that computes the sum of all proper divisors of a given number lisp resolved professionally and stay updated to the latest Lisp updates.

### Lisp answers related to "Write a function that computes the sum of all proper divisors of a given number lisp"

View All Lisp queries

### Browse Other Code Languages 