All pastes #965247 Raw Edit

Unnamed

public text v1 · immutable
#965247 ·published 2008-03-31 21:12 UTC
rendered paste body
# n is the row, and k is the position along the row.

def n_choose_k(n,k):
   if n <= 1 or k <= 0 or k >= n: return 1
   return n_choose_k(n-1,k-1) + n_choose_k(n-1,k)