def distinct_powers(a, b):
    """Generate distinct terms in a**b"""
    numbers = []

    for i in range(a[0], a[1]+1):
        for j in range(b[0], b[1]+1):
            numbers.append(i**j)

    # Set makes it the numbers values unique
    return set(numbers)