Project Euler – Problem 145 Solution

Problem

Some positive integers n have the property that the sum [ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbersreversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).

There are 120 reversible numbers below one-thousand.

How many reversible numbers are there below one-billion (109)?

Solution

The solution I have posted here solves the problem but it takes a good 15 mins or so to run so doesn’t meet the 1 minute rule.. unfortunately brute force is the only way I know how to solve this problem :-(

Leave a Comment

Your email address will not be published. Required fields are marked *