Two-Base Palindromes
A palindrome reads the same from left to right and from right to left. Write a function double_base_palindrome_sum that finds all numbers less than n that are palindromes in both base 10 and base 2. Check the binary form without leading zeros. Return the sum of all matching numbers.
Примеры
Ввод
1000000Вывод
872187Ввод
10Вывод
25Ввод
100Вывод
157Нужно реализовать
def double_base_palindrome_sum(n: int) -> int:
Теги
mathstrings
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteachVisible tests
1
Input
1000000Expected
8721872
Input
10Expected
253
Input
100Expected
1574
Input
1000Expected
17725
Input
9Expected
166
Input
1Expected
0Focus radio
Paused · SomaFM · Fluid