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
Log in om je inzendingsgeschiedenis te zien
InloggenLog in om de AI-mentor te gebruiken
InloggenVisible tests
1
Input
5Expected
152
Input
100Expected
91833
Input
2Expected
14
Input
3Expected
45
Input
10Expected
696
Input
-1Expected
0Focus radio
Paused · SomaFM · Fluid