Java8
Using the new IntStream stuff, this becomes essentially a one liner, if you ignore the obligatory Java Framework stuff:
import java.util.stream.IntStream; public class A{ public static void main(String[] args){ System.out.println(IntStream.rangeClosed(Integer.parseInt(args[0], Integer.parseInt(args[1])).filter(x -> ((Integer)x).toString().contains(args[2])).toArraycount().length); } } It can be run herehere, although I did have to hardcode the values.