# Obtaining Overrepresented Motifs in DNA Sequences, Part 12.5

So let’s modify a little bit the factorial function and then benchmark both by using `timeit`. Ideally our factorial function would need to calculate a value similar to the binomial expansion, as we have three factorials to calculate in for each binomial in the Hypergeometric Distribution. So we can add two extra factorial calculations to our function and perform the multiplication and division to return the equivalent to the binomial calculation. So the function would be
`m` and `n` are both values of the binomial and `n - m` is the subtraction of one by the other that forms the last factorial to be calculated. This way it makes easier to time the performance of both functions. In the end the complete script would look like
The final result of the average for ten repetitions is as follow fac = 0.10 s binom = 43.24 s choose = 0.000005 s Clearly, the factorial function gets a huge advantage over the binomial one. So we will modify it a little bit and use it for our HD script. Clearly the `choose` function is the fastest one, so we will incorporate it on out HD script.