Project Euler — Problem 145 Solution

Problem

Some pos­i­tive inte­gers n have the prop­er­ty that the sum [ n + reverse(n) ] con­sists entire­ly of odd (dec­i­mal) dig­its. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such num­ber­sre­versible; so 36, 63, 409, and 904 are reversible. Lead­ing zeroes are not allowed in either n or reverse(n).

There are 120 reversible num­bers below one-thou­sand.

How many reversible num­bers are there below one-bil­lion (109)?

Solution

The solu­tion I have post­ed here solves the prob­lem but it takes a good 15 mins or so to run so doesn’t meet the 1 minute rule.. unfor­tu­nate­ly brute force is the only way I know how to solve this prob­lem :-(