2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,19 @@
(ns left-factorial
(:gen-class))
(defn left-factorial [n]
" Compute by updating the state [fact summ] for each k, where k equals 1 to n
Update is next state is [k*fact (summ+k)"
(second
(reduce (fn [[fact summ] k]
[(*' fact k) (+ summ fact)])
[1 0] (range 1 (inc n)))))
(doseq [n (range 11)]
(println (format "!%-3d = %5d" n (left-factorial n))))
(doseq [n (range 20 111 10)]
(println (format "!%-3d = %5d" n (biginteger (left-factorial n)))))
(doseq [n (range 1000 10001 1000)]
(println (format "!%-5d has %5d digits" n (count (str (biginteger (left-factorial n)))))))