# Problem Description
This is a geometric progression problem where we need to calculate the number of inverted green triangles at a given iteration level (t). The problem involves a triangular pattern that grows according to specific rules, starting with a single white triangle and progressively adding more subdivisions, some of which are colored green.

# Visual Facts
1. T=1: Single white triangle, no green triangles
2. T=2: Contains 4 triangles total, with 1 green triangle
3. T=3: Multiple layers of triangles, containing 6 green triangles
4. T=4: Even more layers, with significantly more green triangles
5. Each iteration adds more layers to the triangle
6. Green triangles are always inverted (pointing downward)
7. White triangles are always pointing upward

# Visual Patterns
1. Number of Layers Pattern:
   - T=1: 1 layer
   - T=2: 2 layers
   - T=3: 4 layers
   - T=4: 8 layers
   - T=t: 2^(t-1) layers

2. Green Triangles Count Pattern:
   - T=1: 0 green triangles
   - T=2: 1 green triangle
   - T=3: 6 green triangles = 1 + 2 + 3
   - T=4: 28 green triangles = 1 + 2 + 3 + 4 + 5 + 6 + 7
   - T=t: Sum of first 2^(t-1)-1 natural numbers


# Solution
def solution(t: int) -> int:
    """
    Calculates the number of green triangles at a given iteration level.

    Parameters:
        t (int): The iteration level to calculate.

    Returns:
        int: The number of green triangles at iteration level t.
    """
    inverted = 0
    regular = 1

    for _ in range(2, t + 1):
        new_inverted = regular + 3 * inverted
        new_regular = inverted + 3 * regular
        inverted, regular = new_inverted, new_regular

    return inverted


# Test Script
def test():
    test_cases = [
        (1, 0),
        (2, 1),
        (3, 6),
        (4, 28),
        (5, 120),
        (6, 496),
        (7, 2016),
        (8, 8128),
        (9, 32640),
        (10, 130816)
    ]

    for (t, expected_output) in test_cases:
        try:
            output = solution(t)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`t`: {t}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`t`: {t}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()