Project Euler 714 - Duodigits

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

Note: I am not happy with my solution as it is brute force and takes ~180 seconds to run

Thought Process

After a few different methods I ended up essentially brute forcing the problem. I generate all duodigits up to a certain number of digits, and then I test for each number 1 to 50,000 whether or not the duodigit multiple is contained. If they are all then great the problem is done, if not I manually generate more duodigits.

One key insight is that it appear that if n is divisible by 10, then its duodigit multiple is larger than an average number, but for the duodigit multiple, one of the digits must be 0 which greatly reduces the cases.

Through trial and error, I found that generating all 15 digit duodigits works for all n not divisible by 10, and generating all 21 digit duodigits that must have 0 as one of their digits works for all n divisible by 10.

Below I include my code with comments

Interactive Code

Enter an integer (yourinput)

Code will output D(yourinput)

Note: Code is not efficient, hence please keep yourinput < 5000