Quote:
My question is how will I find out the factorial from this array (prime number)
Suppose, I copy the prime numbers into an array
then ?
This is not the right question. Actually computing the factorial is not requested (on the contrary, the requirements suggest avoiding it).
Now, how could you possibly produce the requested output without actually computing the factorial?
Consider, for instance,
5
.
You know
5! = 5 * 4 * 3 * 2 * 1
That is
5! = 5 * (2*2) * 3 * 2 * 1
Producing the output
(2,3), (3,1), (5,1)
Note that, if you procede from
2
to
99
, having computed the output for
5
, makes you know a big deal of the output for
6
, because
6! = 6 * 5! = (2*3) * 5!