Problem 53

completed December 9, 2011

Comments

This one was rather easy. I defined the function nCk, then iterated over all the n less than or equal to 100.

Results

Acheived in about a half second.

Code

from math import factorial
def nCk(n, k):
	return (factorial(n))/(factorial(k)*factorial(n-k))

sum = 0
for n in range(1, 101):
	for k in range(1, n+1):
		if nCk(n, k) >= 10**6:
			print n, k, nCk(n, k)
			sum += 1
			
print sum