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.


Each test case contains a number N (2 ≤ N ≤ 10000).


The output should contain a line representing the prime factorization of the factorial given number, which should be of the form: p1^e1 * p2^e2 * ... * pk^ek where p1, p2, ..., pk are the distinct prime factors of the factorial of the given number in increasing order, and e1, e2, ..., ek are their exponents.



2^8 * 3^4 * 5^2 * 7^1

hide comments
stranger77: 2017-02-07 10:56:49

Easy one AC in 1 go......0.0sec!

aeonflux: 2016-12-11 16:39:17

no need of sieve..simple brute force works!!!!

Anuj Arora: 2016-09-03 21:26:30

AC in one go!!! 111th question

Last edit: 2016-09-03 21:27:14
vinay12345: 2016-08-25 17:37:30

AC in one go ...0.00sec

mkfeuhrer: 2016-06-14 23:33:55

AC in 1 go :-) my 100th :-) prime funn..!

AD: 2016-06-14 21:35:46

Easy one ! Simple trial division will do. :D

pranjalikumar9: 2016-05-21 10:40:05

De Polignac's :) learnt something new!

sy_117: 2016-04-05 23:50:26

wow such a nice ques nD i got AC in 0.0 sec !!!!! :P

hanstan: 2016-04-05 19:13:17

Care the limit is for N more than 10000...
Finally AC 0.00s

surya2196: 2016-04-03 22:58:15

lolypop question

Added by:Amlesh Jayakumar
Time limit:0.197s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:DWITE Programming Contest 2012 (Own Problem)