Skip to content

Instantly share code, notes, and snippets.

@bwesterb
Created July 4, 2014 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwesterb/7eab3f2b86d2e58f917d to your computer and use it in GitHub Desktop.
Save bwesterb/7eab3f2b86d2e58f917d to your computer and use it in GitHub Desktop.
import math
import random
from fractions import Fraction
D = 365
def ncr(n, r):
return math.factorial(n) / math.factorial(r) / math.factorial(n-r)
points = []
for N in xrange(3000, 4000):
ret = 0
for l in xrange(1, D + 1):
a = (-1)**(l+1) * ncr(D, l) * (D - l)**N
ret += a
ret = Fraction(ret, D**N)
points.append((N, float(ret)))
print N, float(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment