Algebraic Groups and Lie Groups with Few Factors