Distinct Powers¶
Python offers a built-in set type that will only keep track of distinct items for us. We also don't need to worry about overflows, since integers are unlimited precision.
In [1]:
len({a ** b for a in range(2, 101) for b in range(2, 101)})
Out[1]:
9183
Copyright (C) 2025 filifa¶
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.