Digits of a Power
Large powers quickly become long numbers, but Python can still work with them directly. Write a function power_digit_sum that raises 2 to the power e, then adds all digits of the resulting number. Return the digit sum, not the huge number itself.
Примеры
Ввод
4Вывод
7Ввод
15Вывод
26Ввод
1000Вывод
1366Нужно реализовать
def power_digit_sum(e: int) -> int:
Теги
math
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
4Expected
72
Input
15Expected
263
Input
1000Expected
13664
Input
0Expected
15
Input
10Expected
76
Input
1Expected
2Focus radio
Paused · SomaFM · Fluid