Here is simple math program to list number whose all factors are in given set of factors.
I have included my timing decorator, which uses my timestring function, so I included that and imports for decorator in the decorator function, bit against the rules. Of course I could have used also the timeit module.
I have implemented task by using previous results and expanding those and using modified sieve algorithm. For the sieve method you should provide your favorite prime_sieve in module utils or change the name according to your module/function name.