python factorial series to match first pair in range
<p>I'm a newbie and I'm trying to code the following factorial series in python to calculate the first matching number in a series within a finite range. 
kd×d×(d−1)×⋯×(d−k+1)d×d×⋯d=k(d−1)!dk(d−k)!
so the expected value for the number needed for a match is
∑k=1d(k+1)k(d−1)!dk(d−k)!.</p>

<p>Due to the size of the numbers it errors:
OverflowError: long int too large to convert to float
So I'm using logs but still getting an error.  Wondering if anyone has an good idea on this. </p>

<pre><code> m = 365
  q = 1
  a=[]
  for x in range(q,m):
    #y = y + x*(1/365)
    #####y = y + (factorial(x)/(factorial(m-x)*(exponent(m,x))))
    a.append((log((factorial(m))/exponent(m,x)))*log((q+x)/m))
    #y = [(m-x)*factorial(m-x)/m]
    #print ("x: ",x,"   y: ",y)
  #return "a:",a,"  product-sum:",[a*a for a in a]
  return sum(a)
</code></pre>

<p>Sorry I see the equation above isn't clear.  Here's what I'm trying to get at:
<a href="http://en.wikipedia.org/wiki/Birthday_problem#Average_number_of_people" rel="nofollow">http://en.wikipedia.org/wiki/Birthday_problem#Average_number_of_people</a></p>
