factorized is an elegant function (returns list), but most of the time, we didn't need all factors, just 1st of them.
new factor should be class that return factor object, which has this properties:
factor(N).__iter__() returns generator that yielded all elem as same as factorized. (so we can do product(factor(N)) == N)
factor.(N)items() returns tuple of (prime, power).
factor(N).__mul__(M) gives output as same as factor(N*M), just faster because we already know that N*M is not prime.
factor(N).__str__() show string repr of the factor in this example form: 2**5 * 3**2 * 7**1 * ...
factorizedis an elegant function (returns list), but most of the time, we didn't need all factors, just 1st of them.new
factorshould be class that return factor object, which has this properties:factor(N).__iter__()returns generator that yielded all elem as same asfactorized. (so we can doproduct(factor(N)) == N)factor.(N)items()returns tuple of(prime, power).factor(N).__mul__(M)gives output as same asfactor(N*M), just faster because we already know thatN*Mis not prime.factor(N).__str__()show string repr of the factor in this example form:2**5 * 3**2 * 7**1 * ...