# Find two prime factors of a number so that the multiplication of factors give the original number

I have a number say N, I need to divide this number into p and q so that when I multiply p and q I would get original number back. Also, p and q should be two prime numbers.

Google search suggest to find the factor of the number.link. See the example and it's subsection, factor.

Now, I can understand if the number N itself is a prime number then I can find it's two factors as prime number. Like if N is 23, I can get two factor 1 and 23 and they are prime. Otherwise, if the number N is a squared number like 49 or 25 I can get there factors, and the factors are prime numbers.

Like if N is 49 and it's factors are 7 and 7 both are prime numbers.

Now, N not necessarily a prime number. It could be a non prime number like if the N = 2,542, Factors are = 2 x 31 x 41, where 31 and 41 are prime numbers but 31*41 = 1,271 which is not equal to 2542.

So, the question arise how could I divide a number into two prime numbers so that there multiplication should be the original number

• This is - unsurprisingly - only possible if $N$ is the product of two prime numbers. May 6, 2022 at 15:28
• This is hard to follow. $1$ is not a prime. Most numbers are not the product of two primes. For those that are...well, factoring large numbers is really hard.
– lulu
May 6, 2022 at 15:29
• Perhaps you would benefit from reading about the fundamental theorem of arithmetic
– Joe
May 6, 2022 at 15:33
• uniquely as the product of $m$ primes, where $m\ge 1$. So $1200=2*2*2*2*3*5*5$, which is the product of 7 primes (not distinct). So, as @HagenvonEitzen commented, you can only find two primes that multiply to give $n$ if $n$ is in fact the product of two primes, meaning that its prime factorization contains only two primes (not necessarily distinct). Otherwise, there is no way to find two primes that multiply to give $n$.
– Joe
May 6, 2022 at 16:10
• Maybe you should change your question to be about that problem, and use the "cryptography" tag.
– Joe
May 6, 2022 at 18:08