```python
def tetrahedral_number(n):
    """
    Calculates the nth tetrahedral number.

    A tetrahedral number is a figurate number that represents a tetrahedron.
    The formula for the nth tetrahedral number is n * (n + 1) * (n + 2) / 6.
    """
    if n < 0:
        return 0
    
    result = n * (n + 1) * (n + 2) // 6
    return result

```