Skip to content

Instantly share code, notes, and snippets.

@aoeuidht
Created January 14, 2013 08:12
Show Gist options
  • Save aoeuidht/4528572 to your computer and use it in GitHub Desktop.
Save aoeuidht/4528572 to your computer and use it in GitHub Desktop.
def sigma(n):
return n and (n + sigma(n-1)) or 0
def sigma_tail(n, sum=0):
return n and sigma_tail((n-1), (n+sum)) or sum
print sigma(50)
print sigma_tail(50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment