added test case for factors appearing multiple times (e.g. 4 = 2*2)