Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun factorial (n)
- (let ((result 1))
- (dotimes (i n result)
- (setf result (* result (1+ i))))))
- (defun combinations (m n)
- (/ (factorial m) (* (factorial n) (factorial (- m n)))))
- (defun harmonic (n)
- (let ((result 0))
- (dotimes (i n result)
- (incf result
- (* (expt -1 i) (/ 1 (1+ i))
- (combinations n (1+ i)))))))
- (defun question-1 (m)
- (let ((result 0))
- (dotimes (n (1+ m) result)
- (incf result
- (* (/ 1 (+ n 1)) (combinations m n))))))
- (defun question-1-2 (m)
- (let ((result 0))
- (dotimes (n (1+ m) result)
- (incf result
- (/ (factorial m)
- (* (factorial (1+ n)) (factorial (- m n))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement