0

Hi fellas..this is my first post here..I am new to this 'hardcore programming' and all..I came across a problem for which I killed some time..with no fruits..It might be simple,trivial or even 'famous' for you guys..Any assistance is appreciated much.So here it goes..
Given an integer,the problem is to find the prime number combination whose product form the number since any integer can be given as a product of one or more primary numbers..
For eg..for 36,the solution would be 2,2,3,3.
Another thing..a pseudo code or algorithmic description is sufficient..thanks again..

Edited by Rexzie: n/a

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Rexzie
0

1) Create an array of prime numbers less than or equal to the given number.
2) If the given number is prime, you're done.
3) If not find the smallest prime number that is a factor of the given number and then find the other factor associated with that prime number.
4) If the associated factor is prime, then you're done.
5) If not repeat the steps 3 and 4.

0

1) Create an array of prime numbers less than or equal to the given number.
2) If the given number is prime, you're done.
3) If not find the smallest prime number that is a factor of the given number and then find the other factor associated with that prime number.
4) If the associated factor is prime, then you're done.
5) If not repeat the steps 3 and 4.

Thanks man..could have been a bit deeper & clearer though..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.