PTIME  Prime Time
For your math homework this week your teacher gave you five large numbers and asked you to find their prime factors. However these numbers aren't nearly large enough for someone with knowledge of programming like yourself. So you decide to take the factorial of each of these numbers. Recall that N! (N factorial) is the product of the integers from 1 through N (inclusive). It’s your job now to create a program to help you do your homework.
Input
Each test case contains a number N (2 ≤ N ≤ 10000).
Output
The output should contain a line representing the prime factorization of the factorial given number, which should be of the form: p_{1}^e_{1} * p_{2}^e_{2} * ... * p_{k}^e_{k} where p_{1}, p_{2}, ..., p_{k} are the distinct prime factors of the factorial of the given number in increasing order, and e_{1}, e_{2}, ..., e_{k} are their exponents.
Example
Input: 10 Output: 2^8 * 3^4 * 5^2 * 7^1
hide comments
AD:
20160614 21:35:46
Easy one ! Simple trial division will do. :D 

pranjalikumar9:
20160521 10:40:05
De Polignac's :) learnt something new!


sy_117:
20160405 23:50:26
wow such a nice ques nD i got AC in 0.0 sec !!!!! :P 

hanstan:
20160405 19:13:17
Care the limit is for N more than 10000...


surya2196:
20160403 22:58:15
lolypop question 

rccroshan1:
20160221 09:15:27
The spaces costed me 1 WA. 

shubham_garg:
20160220 03:09:18
Nice question for sieve practice.


cqui:
20151024 01:21:27
I had a runtime error (SIGSEGV), I think it ment I was using too much memory, took me a few attempts to realize. 

prakash_reddy:
20151019 20:06:12
Nice question.... :) 

SangKuan:
20150816 16:22:56
ac with 0.0 sec 
Added by:  Amlesh Jayakumar 
Date:  20120619 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  DWITE Programming Contest 2012 (Own Problem) 