Project Euler Problem 20
問題20: 100! の各桁の数字の合計を求めよ。[=>問題文]
問題20の解答
;; Emacs Lisp (require 'cl) (require 'bigint) (defun problem020 () (let ((str (bigint-to-string (bigint-fact 100)))) (apply #'+ (mapcar #'(lambda (c) (- c ?0)) str)))) (problem020)
bigint ライブラリに階乗関数を追加して終了です。