def sigma(n): res = n * (n + 1) / 2 # = (n + 1) * n / 2 # = (n * n / 2) + (n / 2) return int(res) for i in range(5): print('sigma({}) = {}'.format(i, sigma(i)))
To embed this project on your website, copy the following code and paste it into your website's HTML: