MathsReadCompetitive mathematics
Algorithmic puzzle · integer answermedium50 min

Two-base mirrors with a checksum

Digit Algorithms

Count positive integers n < 1000000 that are palindromes both in base 10 and in binary (without leading zeroes) AND whose decimal digit sum is divisible by 3.

Solve using mathematics, algorithms, or your own code offline. Submit only the final integer here—no program, expression, graph, or written proof.

Check your answer without signing in. Sign in to save your progress.

Accepted format: a whole number such as 42 or 123456789. No commas, formulas, or source code.

How to approach this problem

Generate decimal palindromes by reflecting their first half. Check the binary representation without leading zeroes and then apply the digit-sum condition.

Worked example with different values

33 is a decimal palindrome and its binary expansion 100001 is also a palindrome. Its decimal digit sum is 6.

Apply the same reasoning to the challenge. This example is a separate practice problem.

Learn the technique: Number theory: divisors, gcd and modular arithmetic

Report a question or explanation issue

Back to problems →