FACTCG2 - Medium Factorization

The task in this problem is to write a number in a multiplication of prime numbers separated by “ x ”. You need to put the number 1 in this multiplication.

Input

The input consists of several lines.

Each line consists of one integer N (1 <= N <= 10^7) .

Output

For each line you need to output the factorization separated by “ x ” and including 1.

Sample

Input
1
2
4
8

Output
1
1 x 2
1 x 2 x 2
1 x 2 x 2 x 2

Added by:Phyllipe Medeiros
Date:2012-02-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2016-01-11 22:24:50 Himanshu Bansal
nice qus...learned a lot.......!!
2015-12-21 12:28:07 Nilesh
Finally accepted after too many WAs!!! =D
2015-12-17 16:46:48 yash sharma
DONT USE long long int - GIVES TLE
USE ONLY int
2015-10-28 19:05:38 Ashwani Gautam
Do not print "X" print "x" as written, and there is a space between every character.Solution look like this
"1 x 2 x 2" for 4.
and do anyone how to do this in python?

Last edit: 2015-10-29 09:05:11
2015-07-31 06:20:34 Dushyant Singh
Nice problem. The real challenge would be to do it in python!
2015-06-09 13:07:32 i_am_looser
lots of wrong answer because of X instead of x.
2015-04-10 20:22:34 Aadil Ahmad
Can someone please provide me some test cases, I am getting wrong answer :(
2015-03-06 05:56:08 Shounak Chatterjee
how many test case we should take??
2015-03-04 05:21:19 Ankur Singh
take care of output format : print " x " instead of "x".
2015-02-11 13:54:00 Madhav
good question..Learnt a new way of factorization.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.