Given a natural number, What is the maximal natural number below it, whose sums of digits in base 10 and base 2 are the same? Is there a clever algorithm to do this aside from the brute force search? A related question is: What is the maximal natural number the sum of the digits in the binary and decimal representations of which both equal to a given natural number? We can see that, in the sequence of natural numbers the binary and decimal representations of which are equal, an even number $n$ appears if and only if the odd number $n+1$ does. I have posted this question in math.stackexchange.com and have not gotten any answer.