A ten digit number formed without repetition using numbers $0$ to $9$ is divisible by $11111$. Find the greatest and smallest such number.

A ten digit number is formed by using the numbers between $$0$$ and $$9$$ without repetition. If the number formed is divisible by $$11111$$. Find the greatest and smallest such number.

The only thing I could conclude is that the sum of digits of the the number formed will be $$45$$. It is a factor of $$9$$. So the number will be divisible by $$9$$. As we know that if any number $$N$$ is divisible by $$a$$ and $$b$$ and if $$a$$ and $$b$$ are co-primes, then the number is divisible by $$a\cdot{b}$$. So the factor of that number is $$99999$$. How to proceed further?

• Just saying 11111 is prime. – abc... Feb 25 '19 at 5:54
• @abc...:no, it is $41\cdot 271$ – Ross Millikan Feb 25 '19 at 5:54
• @RossMillikan Thank you for pointing it out and it's probably time not to trust online prime factorisation. It just said 11111 is prime. :( – abc... Feb 25 '19 at 5:58
• What tools are allowed? There are only $3$ million numbers, so check them all. – Ross Millikan Feb 25 '19 at 6:10
• An interesting observation is that 100000 = 9 * 11111 + 1 which is to say that 100000 is congruent to 1 modulo 11111. This means that you can always switch the first and second half of your number without changing its divisibility by 11111. – Statistic Dean Feb 25 '19 at 15:07

Edit 2 : Ok, I thought of a way to prove this. If a number that obeys the rule is higher than 9876501234, it has to have the same five first digits, therefore, we can only look at the 5 last digit. 5 + 0, 1, 2, 3 or 4 gives you 5, 6, 7, 8 or 9, which means the multiple of 11111 we're looking for (by summing the first and last part) must ends with one of those numbers. Those multiple of 11111 always have all digits equal except maybe the last one and first one. As a result, let's call $$x_0, ... , x_4$$ those last five digits, we have $$x_0 + 9- \epsilon [10] = x_1 + 8 [10] = ... = x_4 + 5 - \epsilon [10]$$ where $$\epsilon$$ is either 0 or 1. The only possibility there is that $$x_i$$=9-i. This is enough to prove that 9876501234 is the highest number with such a property. The same reasoning works for the smallest number as well.