5022 - Prime Factors   

Description

Webster defines prime as:

 


prime (prim) n.[ME, fr. MF, fem. of prin first, L primus; akin to L prior] 1 :first in time: original 2 a : having no factor except itself and one $langle$3 is a   number $
angle$ b : having no common factor except one $langle$ 12 and 25 are relatively  $
angle$ 3 a : first in rank, authority or significance : principal b : having the highest quality or value $langle$  television time $
angle$ [from Webster's New Collegiate Dictionary]

 


The most relevant definition for this problem is 2a: An integer g>1 is said to be prime if and only if its only positive divisors are itself and one (otherwise it is said to be composite). For example, the number 21 is composite; the number 23 is prime. Note that the decompositon of a positive number g into its prime factors, i.e.,

egin{displaymath}g = f_1 	imes f_2 	imes dots 	imes f_n
end{displaymath}


is unique if we assert that fi > 1 for all i and $f_i le f_j$ for i<j.

One interesting class of prime numbers are the so-called Mersenne primes which are of the form 2p- 1. Euler proved that 231 - 1 is prime in 1772 -- all without the aid of a computer.

Input

vaThe input will consist of a sequence of numbers. Each line of input will contain one number g in the range -231 < g <231, but different of -1 and 1. The end of input will be indicated by an input line having a value of zero.

Output

For each line of input, your program should print a line of output consisting of the input number and its prime factors. For an input number $g>0, g = f_1 	imes f_2 	imes
dots 	imes f_n$, where each fi is a prime number greater than unity (with $f_i le f_j$ for i<j), the format of the output line should be


egin{displaymath}g mbox{	t = } f_1 mbox{	t x } f_2 mbox{	t x } dots mbox{	t x } f_n
end{displaymath}


When g < 0, if $ mid g mid = f_1 	imes f_2 	imes dots 	imes f_n$, the format of the output line should be

egin{displaymath}g mbox{	t = -1 x } f_1 mbox{	t x } f_2 mbox{	t x } dots
mbox{	t x } f_n
end{displaymath}


Sample Input  Download

Sample Output  Download

Tags




Discuss