User Tools

Site Tools


prelude_to_factovisors

This is an old revision of the document!


Prelude to Factovisors

For this prelude, you are to find all the prime factors of a number.

Input

Input consists of a sequence of non-negative integers, one per line, each less than 2^31. The last entry is a 0, which should not be processed.

Output

For each non-zero input value, n, determine find the prime factors. Print all factors on a single line as a sequence of terms of the form p^m, indicating that prime p appears m times in n.

Sample Input

7
10
0

Sample Output

7^1
2^1 5^1
prelude_to_factovisors.1316980463.txt.gz · Last modified: 2011/09/25 12:54 by jtkorb