Practice Problem #2
Prime Factorization

Every positive integer greater than 1 can be written as the product of prime integers (integers which have no factors other than +1, the integer itself, and its additive inverse).

Write a program to decompose any integer into a product of prime integers. The program should output each prime factor of the integer along with the exponent which is the number of occurrences of the prime in the factorization of the integer.

The input consists of a single positive integer greater than 1, the number to be factored. For example, the input may be

24

The output is a sequence of ordered pairs of positive integers. The first integer in a pair is a prime factor of the input and the second integer is the exponent which gives the number of occurrences of this prime in the factorization of the input. Each pair should appear on a separate line. The above input produces the following output:

2   3
3   1
Of course if a prime number is input, such as:
17
the program should produce a single line of output:
17   1