Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Created December 22, 2018 00:06
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 CamDavidsonPilon/39560f562da0a9ed6b580ee1b2c6962f to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/39560f562da0a9ed6b580ee1b2c6962f to your computer and use it in GitHub Desktop.
def falling_factorial(k, n):
product = 1
counter = k
while counter > n:
product *= counter
counter -= 1
return product
f = lambda k: 2 * falling_factorial(k, k-100) - k**100
assert f(7174) < 0
assert f(7175) > 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment