Advertisement
DeaD_EyE

small gauss

Jun 8th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. def small_gauss(n):
  2.     """
  3.    Returns the sum of 1...n
  4.    
  5.    Code to proof:
  6.    >>> summer = lambda n: sum(m for m in range(1, n + 1))
  7.    >>> summer(101)
  8.    5151
  9.    """
  10.     return (n ** 2 + n) // 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement