def pyramidal_nums(n):
    """
    Returns a list of all pyramidal numbers less than or equal to n
    A pyramidal number is defined as: f(num) = (num**3 - num) / 6
    """
    res = [1]
    for i in range(3, n):
        p = (i**3 - i) // 6
        if p < n:
            res.append(p)
        else:
            return res