Fast generation of permutations

Anton Vredegoor anton.vredegoor at gmail.com
Sun Jan 29 09:37:27 EST 2006


Paul Rubin wrote:

> Cool, I'd still like to know why (13**5)-13 = C(52,5) other than
> by just doing the arithmetic and comparing the results.  Maybe your
> tkinter script can show that.

That seems to be very hard :-) Unless I'm missing something.

Anton

def noverk(n,k):
    return reduce(lambda a,b: a*(n-b)/(b+1),range(k),1)

print noverk(52,5)
print 13**5-13

#prints:

2598960
371280




More information about the Python-list mailing list