#! /usr/bin/env python3 """ pe29.py https://mind.kittttttan.info/py/pe29 """ def pe29(n=100): """ How many distinct terms are in the sequence generated by ab for 2 <= a <= 100 and 2 <= b <= 100? """ print(len(list(set(a**b for a in range(2, n+1) for b in range(2, n+1))))) if __name__ == "__main__": pe29()