Project Euler 38 - Pandigital multiples
Official link: https://projecteuler.net/problem=38
Thought Process
Let's look into some properties we can find, let x be an integer
The concatenated product of x and (1)
x must be 123456789 for this to be pandigital multiple
The concatenated product of x and (1,2)
We need x and 2x to have 9 digits amongst each other => x must be a 4 digit integer
The concatenated product of x and (1,2,3)
x, 2x, 3x must have 9 digits, if x = 99 => 2x and 3x have 3 digits maximum so we have a total of 8 digits. This means x must be a 3 digit number
I think you can see where this is going let's try to generalise it a bit more
The concatenated product of x and (1,2,...,z), where z < 10 because obviously we cannot go greater than 9
x < 10^(floor(9/z))
So now given a z we can limit the range of x and begin testing if it will form a pandigital multiple, add all them to a list and return the maximum of the list
Interactive Code
No interactive code for this one, my code is shown below