Prime digits checksum
Prime Search
For each prime p at most 75000, keep p if the sum of its decimal digits is also prime. Return the sum of all kept primes, modulo 1000003.
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.
How to approach this problem
Build a primality lookup that includes the largest possible digit sum. Compute each prime’s digit sum, test it, and reduce the running total modulo the requested modulus.
Worked example with different values
Below 20, the retained primes are 2, 3, 5, 7 and 11. The prime 13 has digit sum 4 and is excluded. The retained sum is 28.
Apply the same reasoning to the challenge. This example is a separate practice problem.
Learn the technique: Prime numbers and reversible primes