you should always put the cheapest test first: `if factor and not factor.has(f(x))`. That way, if factor is 0 the other method won't have to get called. I don't think it will make a big difference here, but it's a good habit to get into.