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
PostgreSQLv16

Le résultat de l'exécution du code s'affichera ici

Visible tests
1
Input
1000000
Expected872187
2
Input
10
Expected25
3
Input
100
Expected157
4
Input
1000
Expected1772
5
Input
9
Expected16
6
Input
1
Expected0
Focus radio
Paused · SomaFM · Fluid