Solution

I did it the naive boring way …..

distinct_values = set()
for a in range(2, 101):
    for b in range(2, 101):
        distinct_values.add(a ** b)
print(len(distinct_values))

References

Project Euler - 29