Find the max difference between two consecutive numbers in the next series The series of numbers starting with
123456789
And eding with:
987654321
only counting the numbers in between without repetitive digits.
To clarify, if we were doing this starting with 99 and ending with 128.
The valid numbers for the series would be: 102,, 103, 104, 105, 106, 107, 108, 109, 120 , 123 , 124, 125, 126, 127, y 128.
And the answer would be 11 (difference between 109 y 120).
 A: 890123456-879654321=10469135
If you watch only first two digits of the wanted number, like 89, 87 in the given example. They should be around some forbiden number, in this case 88. This way you ensure there will be more than 10,000,000 numbers between, if first two digits of wanted numbers are consecutive numbers difference will be less than 10,000,000 since third digit of smaller number is greater than third digit of larger number.
You can try each of 21...., 23....; 32...,34...; to find out largesr difference is the one at the top
A: I was curious, so I wrote some code that calculates, and locates, this difference for numbers written according to a similar scheme in an arbitrary base $b>3$. (For $b\le 3$, the problem is vacuous at best.) As you can see, the method used by Djura Marinkov on this page applies for each base tested: the largest gap includes the $b^{b-3}$ numbers with first two digits both equal to $b-2$. Thus, the size of the largest difference grows quickly with $b$.
$$\begin{array}{c|c|c|c} 
 \text{b} & \text{max difference} & \text{source} & b^{b-3} \\ \hline
4 & 5 & 230_4-213_4  & 4 \\ \hline
5 & 30 & 3401_5-3241_5 & 25  \\ \hline
6 & 247 & 45012_6-43521_6 & 216 \\ \hline
7 & 2648 & 560123_7-546321_7 & 2401 \\ \hline
8 & 35275 & 6701234_8-6574321_8 & 32768 \\ \hline
9 & 562810 & 78012345_9-76854321_9 & 531441 \\ \hline
10 & 10469135 & 890123456-879654321 & 10000000
\end{array}$$
