Submit | All submissions | Best solutions | Back to list |
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: 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.
Example
Input: 10 Output: 2^8 * 3^4 * 5^2 * 7^1
Added by: | Amlesh Jayakumar |
Date: | 2012-06-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | DWITE Programming Contest 2012 (Own Problem) |
hide comments
|
||||||||||||
2014-11-06 13:55:45 Kid Algorist
Limit is beyond 10000. Change code to adjust primes till 10007 to be safe. WA for using primes till 9973, AC for 10009 |
||||||||||||
2014-10-06 21:30:01 ivar.raknahs
learned a new thing! AC. |
||||||||||||
2014-08-21 21:35:12 arun vinud
Very nice and easy problem :) |
||||||||||||
2014-08-07 14:23:14 Anurag Mandilwar
Good problem!! |
||||||||||||
2014-02-19 20:12:06 Gautam Kumar
@Amlesh Jayakumar can u please tell me for which value my code is giving wrong answer. My id is 11097375. Got it..i was missing spaces..gud problem. Last edit: 2014-02-19 20:14:45 |
||||||||||||
2014-02-16 10:25:08 heatOn
Strange , using long long int for all variables gives AC in 0 seconds but using int gives AC in 0.1. Last edit: 2014-02-16 10:30:05 |
||||||||||||
2014-02-15 15:39:06 hiddenman
good 1..... :) |
||||||||||||
2013-12-31 16:37:53 pika_pika
don't consider the limit as 10000. I used a dynamic limit of the input to run the code and sieve. AC now. and no need of EOF |
||||||||||||
2013-12-28 05:43:14 Manu Narsaria
nyc problem... how is it completed in 0.0sec in c/c++... |
||||||||||||
2013-12-27 17:59:44 Blue Moon
Enjoyed doing it!! |