If match[b] is an Add, u could be either e.g. `gcd((f(x) + c*f(x)).args) -> f(x)` or `gcd((c + c*f(x)).args) -> c`. Since u is suppose to be the f(x)-dependent part you should use `u = match[b].primitive()[1]` for the `is_Add` case. 