Paste number 18743: birthday problem

Paste number 18743: birthday problem
Pasted by: evanpro
When:3 years, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+EGN
Channel:None
Paste contents:
Raw Source | XML | Display As
;;; probability that any two members of a group of N
;;; will match in a space of M
 
(define (birthday N M)
   (let birthday-count ((product 1)
                        (n 1))
        (if (>= n N)
            (- 1 product)
            (birthday-count (* product (/ (- M n) M)) (+ n 1)))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.