FACT0 - Integer Factorization (15 digits)

题意翻译

**题目描述** 给出一个数n,分解质因数。 **输入格式** 一个正整数n(会有若干行(大约10行),并以0结束)(n<10^15) **输出格式** 每输入一行,会以x^y形式输出(x为质数,y为x的乘方,之间用空格分开)

题目描述

This is a problem to test the robustness of your Integer Factorization algorithm. Given some integers, you need to factor them into product of prime numbers. The largest integer given in the input file has 15 digits. [FACT1](/problem/SP4941) is a harder version of this problem (the numbers are larger). You may need to use a general factorization algorithm since no special numbers (e.g. Fermat numbers) are considered when designing the input data.

输入输出格式

输入格式


There are several numbers given, each one in a line. The input ends with a number 0. The number of test cases is about 10.

输出格式


For each number, print in a line the factorization of it. See examples below for the output format.

输入输出样例

输入样例 #1

3111989
13091989
77145199750673
0

输出样例 #1

317^1 9817^1
17^2 89^1 509^1
328439^1 234884407^1