Project Euler 145 - How many reversible numbers are there below one-billion?

Official link: https://projecteuler.net/problem=145

Thought Process

We are only looking for 1 billion numbers, and we do not even need to account for doubles like in some other problems because 409 and 904 from the example both contribute to the count, therefore I simply brute forced it

I have 1 function

  1. is_reversible(x)

    • Essential a digit sum modification, go through the digits and see if any digit is even, return false, otherwise return true

My original code took ~900 seconds and after some thought, I found a way to make my code 10x+ faster

With this we can actually manually calculate all the number of possible reversible numbers given a digit length, but I chose to just make my code 10x+ faster by only checking up till 10^8 and get the answer in ~65 seconds

Interactive Code

Enter an integer < 10^7 (yourinput)

Code will output number of reversible numbers less than yourinput