Now properly taking into account input values. Fix initialization bug for prime factor computatio