- #1
donglepuss
- 17
- 4
If I select two integers at random, what is the probability that their sum will be prime?
What do you mean by this?donglepuss said:If I select two integers at random
Almost exactly the same as simply selecting one integer [edit: and testing that for primality].donglepuss said:If I select two integers at random, what is the probability that their sum will be prime?
import sympy
import random
n = 1
m = 100000000
N_ITER = 10000000
n_sum_primes = 0
n_single_primes = 0
for i in range( N_ITER ):
p1 = random.randint( n, m )
p2 = random.randint( n, m )
if( sympy.isprime( p1 ) ) :
n_single_primes += 1
if( sympy.isprime( p1 + p2 ) ) :
n_sum_primes += 1
print( n_sum_primes / N_ITER )
print( n_single_primes / N_ITER )
This is not right, because you've wrongly assumed that the limiting case is a valid probability distribution. Which it is not.fresh_42 said:The probability to pick a prime out of all integers is zero.
Indeed. Which means that we cannot properly pose the question about primes in the naturals as a question about probability.PeroK said:The correct answer is that there is no uniform distribution on the integers.
He said randomly selected integers, not positive integers.Jarvis323 said:I would think that the probability that the sum of a pair of randomly selected integers between and is prime would be a little smaller than the probability that an integer selected randomly between and will be prime
FactChecker said:The larger the random number is, the more likely that it has a divisor and that becomes practically certain in the limit. Furthermore, picking a natural number "at random" out of all the natural numbers implies that the picked number would tend to be HUGE. There is no limit to how huge.
To get a non-zero answer, we would have to limit the allowable selection to a finite subset.
My post was just meant to be intuitive. I am not knowledgeable enough to give a formal proof. The others on this thread are more qualified to answer.Keith_McClary said:
Mine, too. Yes, there is no probability distribution and maybe we should have said likelihood instead of probability, or - as I did - relative frequency, or density of primes. And yes, the probability of picking one prime as opposed to a prime as a sum of finitely many integers from a finite set of integers may be slightly different, or not. Fact is, it doesn't matter.FactChecker said:My post was just meant to be intuitive. I am not knowledgeable enough to give a formal proof. The others on this thread are more qualified to answer.
You only need generate one random number.donglepuss said:If I select two integers at random, what is the probability that their sum will be prime?
I think you mean the prime counting function? The RZF is something else.Baluncore said:You only need generate one random number.
The Riemann zeta function approximates the number of primes less than a given magnitude.
Select one random integer, evaluate the derivative of the RZF for that value, and you have the probability that a value of that magnitude will be prime.
All primes are odd, with the exception of 2, which must make 2 the oddest prime of all.PeroK said:That said, if you select an integer and the last digit is not 1, 3, 7 or 9, then the probability it is prime is zero. With one notable exception.
And one less-notable exception.PeroK said:With one notable exception.
(2,3,5),(-2,-3,5),(2,-3,-5) and (-2,3,-5) can also be considered as prime factors. Up to units means that units can be arbitrarily distributed.Baluncore said:The unique prime factors of -30 are; ( 2, 3, -5 ) or ( 2, -3, 5 ) or ( -2, 3, 5 ) or ( -2, -3, -5 ).
I guess all four must be the unique factors.
Prime factors are the numbers that can only be divided by 1 and itself without leaving a remainder. These numbers are the building blocks of all other numbers.
To find the prime factors of a number, you can start by dividing the number by the smallest prime number (2). If the number is divisible by 2, then divide it by 2 and continue dividing by 2 until it is no longer divisible. Then move on to the next prime number (3) and continue the process until the number is fully factored.
The unique prime factors of -30 are -1, 2, and 3. The negative sign does not change the prime factors, so we can ignore it for this calculation.
-1 is considered a prime factor of -30 because it is a number that can only be divided by 1 and itself without leaving a remainder. In this case, -1 is a factor of -30 and is also a prime number, making it a prime factor.
No, a number can only have one set of prime factors. This is because prime factors are unique and cannot be broken down any further. However, a number can have multiple representations of its prime factors, such as 2 x 3 x 5 and 2 x 5 x 3, which are both valid sets of prime factors for the number 30.