Factorization

  1. Define a function factorize(n) which decomposes a natural number into the product of prime numbers. For example, invoking factorize(72) will print out
    
    72 = 2 * 2 * 2 * 3 * 3
    
    
  2. Define a main function which will ask the user to input a natural number. If the input number n is less than or equal to 0, terminate the program. If n is a natural number, invoke factorize(n) and ask the user to input the next number.
  3. The flowchart of functions can be represented as the following figure: Factorization

The program may run as follows:

Please input a natural number to factorize -- 72

72 = 2 * 2 * 2 * 3 * 3

Please input a natural number to factorize -- 79

79 = 79

Please input a natural number to factorize -- 243

243 = 3 * 3 * 3 * 3 * 3

Please input a natural number to factorize -- 0

Note: If you input a very large number (e.g., 12147285369), it may takes your program a long time to factorize it. Be patient.