Factorization (2)
Modify your previous homework about
factorization
as follows:
- Enhance the function
factorize(n)
so that when a prime number occurs multiple times,
it will be shown as ( x ** y ) instead of x * x * x * ... * x.
- Enhance the main() function so that the program
also terminates when the user input an empty string.
- Draw a flowchart of your program and show it to the TA before
you start coding.
The program may run as follows:
Please input a natural number to factorize (<Enter> to exit) -- 15
15 = 3 * 5
Please input a natural number to factorize (<Enter> to exit) -- 72
72 = ( 2 ** 3 ) * ( 3 ** 2 )
Please input a natural number to factorize (<Enter> to exit) -- 89
89 = 89
Please input a natural number to factorize (<Enter> to exit) --