Skip to content

Instantly share code, notes, and snippets.

@cls
Created February 20, 2017 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cls/4cb616f6c639bc878051bd402ae4a0d5 to your computer and use it in GitHub Desktop.
Save cls/4cb616f6c639bc878051bd402ae4a0d5 to your computer and use it in GitHub Desktop.
Calculating the Catalan number series
from fractions import Fraction
def catalan(n):
c = 1
for k in range(2, n + 1):
c *= Fraction(n + k, k)
return int(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment