As an example I want to find all Integers up to a given limit which only have certain prime factors. I can do it efficiently for the case of 2, 3, and 5 by
g = 100;
t1 = Table[{2^x*3^y*5^z}, {z, 0, Log[g]/Log[5]}, {y, 0, Log[g/(5^z)]/Log[3]}, {x, 0, Log[g/(5^z*3^y)]/Log[2]}]
t2 = Sort[Flatten[t1]]
But I am looking for a more general solution where I might have a set of k different factors. I tried Nest
but didn' t get far. And I don't want to use a function like FactorInteger
and then Select
the good ones. I am looking for a solution combining depth of Table
and a (maybe) recursive function of the limits.