Find the total of prime numbers which have been multiplied without having knowledge of them

61 Views Asked by At

Good day.

Suppose that $p$ is prime and that $q$ is prime, and that

$$n = pq.$$

For example if $n = 21,$ then the corresponding "total" is $10 = (3+7).$

Is it possible to get the total of the factors for $n$ without having information of the prime numbers ?

important: I had written a code to guess the factors, and i think it is possible to get the total, but it is important to find the total without bruteforcing or calculating by test and try on.


import math

n = p * q # ex: p=3 q=7

for i in range(1,n):
    s = math.sqrt(n + i**2)
    if s.is_integer() == True:
        print("sum =",s*2) # sum: 10 for i=2  3*7+2**2=25 => sqrt(25)=10//2
        break

thanks in advance,

1

There are 1 best solutions below

3
On BEST ANSWER

There is not a closed function known for this, however, the function you are thinking of is called the $sopfr$ function. See https://mathworld.wolfram.com/SumofPrimeFactors.html for more information.