Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Digital-root/Common-Lisp/digital-root.lisp
Normal file
11
Task/Digital-root/Common-Lisp/digital-root.lisp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(defun digital-root (number &optional (base 10))
|
||||
(loop for n = number then s
|
||||
for ap = 1 then (1+ ap)
|
||||
for s = (sum-digits n base)
|
||||
when (< s base)
|
||||
return (values s ap)))
|
||||
|
||||
(loop for (nr base) in '((627615 10) (393900588225 10) (#X14e344 16) (#36Rdg9r 36))
|
||||
do (multiple-value-bind (dr ap) (digital-root nr base)
|
||||
(format T "~vR (base ~a): additive persistence = ~a, digital root = ~vR~%"
|
||||
base nr base ap base dr)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue