Since 495 is 3*3*5*11, the number must be divisible by 9, 5 and 11.
As it's divisible by 9, the repeated digit must be either 0 or 9. As it's divisible by 5, the last digit must be 0 or 5. As it's divisible by 11, the difference between the sums of the odd and even position digits must be congruent to zero mod 11.
That's the basis for this program (except for the mod 11 part), run under QB64 which allows the MOD function to run on such large numbers.
DEFDBL AZ
DECLARE SUB permute (a$)
CLS
a$ = "1023456789": h$ = a$
low = 99999999999
DO
n = VAL(a$ + "0")
IF n MOD 495 = 0 AND n < low THEN low = n
IF n MOD 495 = 0 THEN high = n
permute a$
LOOP UNTIL LEFT$(a$, 1) = "0"
a$ = "1002346789": h$ = a$
DO
n = VAL(a$ + "5")
IF n MOD 495 = 0 THEN
IF n < low THEN low = n
IF n > high THEN high = n
END IF
permute a$
LOOP UNTIL LEFT$(a$, 1) = "0"
a$ = "1234567899": h$ = a$
DO
n = VAL(a$ + "0")
IF n MOD 495 = 0 AND n < low THEN low = n
IF n MOD 495 = 0 AND n > high THEN high = n
permute a$
LOOP UNTIL a$ = h$
a$ = "1023467899": h$ = a$
DO
n = VAL(a$ + "5")
IF n MOD 495 = 0 THEN
IF n < low THEN low = n
IF n > high THEN high = n
END IF
permute a$
LOOP UNTIL LEFT$(a$, 1) = "0"
PRINT low, high
The results are 10026374985 and 99876534120 respectively.

Posted by Charlie
on 20120707 18:12:09 