Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to get the canonical prime factorization, with zero exponents too

Is it possible to get the 'canonical prime factorization', that means to get prime numbers with zero exponents too.
Example:
I have: factor(45) = 3^2 * 5
I need: factor(45) = 2^0 * 3^2 * 5

F = factor(45)
print 'F = factor(45) = ', F
print 'F[0] =', F[0]
print 'F[1] =', F[1]

Out:

F = factor(45) =  3^2 * 5
F[0] = (3, 2)
F[1] = (5, 1)