number theory

how to solve questions of the type , print all the number in (a,b) having all the digit distinct , or having digit sum a prime number , apart from brute force method ??

What can be the maximum values of a and b?

//