py-tools/tools/int_seq.py

6 lines
107 B
Python

def triangular(n: int) -> int:
"""
0, 1, 3, 6, 10, 15, ...
"""
return int(n * (n + 1) / 2)