Unique Powers

Different pairs of numbers can sometimes produce the same power, such as 4^2 and 2^4. Write a function distinct_powers that checks all values a^b where both a and b go from 2 to n, inclusive. Count how many distinct results appear. A collection that automatically removes duplicates is especially useful here.

Примеры

Ввод
5
Вывод
15
Ввод
100
Вывод
9183
Ввод
2
Вывод
1

Нужно реализовать

def distinct_powers(n: int) -> int:

Теги

mathset
PostgreSQLv16

Ovdje će se prikazati rezultat izvršavanja koda

Visible tests
1
Input
5
Expected15
2
Input
100
Expected9183
3
Input
2
Expected1
4
Input
3
Expected4
5
Input
10
Expected69
6
Input
-1
Expected0
Focus radio
Paused · SomaFM · Fluid