Created
February 6, 2016 19:55
-
-
Save graphbear/853dfeaf620028216242 to your computer and use it in GitHub Desktop.
triangular number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def trinum(n): | |
# calculates the "triangular number" of a number | |
# https://www.mathsisfun.com/algebra/triangular-numbers.html | |
return n*(n+1)/2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment