def solution(exponent: int = 30) -> int:
    """
    For any given exponent x >= 0, 1 <= n <= 2^x.
    This function returns how many Nim games are lost given that
    each Nim game has three heaps of the form (n, 2*n, 3*n).
    >>> solution(0)
    1
    >>> solution(2)
    3
    >>> solution(10)
    144
    """
    # To find how many total games were lost for a given exponent x,
    # we need to find the Fibonacci number F(x+2).
    fibonacci_index = exponent + 2
    phi = (1 + 5 ** 0.5) / 2
    fibonacci = (phi ** fibonacci_index - (phi - 1) ** fibonacci_index) / 5 ** 0.5

    return int(fibonacci)