1. ## Re: Big prime

Originally Posted by diamonddragon
So at the and of the story, if man want to be sure, have to wait, otherwise man is not sure. :)
I ran my method on your number and (after 15 minutes or so on my old laptop) it didn't find any prime factors, so it's definitely prime. The isProbablePrime( ... ) method was also right ;-)

kind regards,

Jos
Last edited by JosAH; 02-02-2012 at 06:58 PM.

2. Senior Member
Join Date
Jan 2012
Posts
210
Rep Power
7

## Re: Big prime

Without Your method, he was not sure. :)

3. ## Re: Big prime

Originally Posted by diamonddragon
Without Your method, he was not sure. :)
Don't think top light of the isProbablePrime( ... ) implementation; the algorithm combines the famous Miller Rabin method and the Lucas Lehmer method; both are draft standards for finding prime numbers. The source can be found in the src.zip file in the JDK directory. For 'small' primes such as Long.MAX_VALUE+30 you can be sure the isProbablePrime( ... ) answer is correct.

kind regards,

Jos
Last edited by JosAH; 02-02-2012 at 09:14 PM.

4. Senior Member
Join Date
Jan 2012
Posts
210
Rep Power
7

## Re: Big prime

Is there a limit above which isProbablePrime( ... ) is not sure?

5. ## Re: Big prime

Originally Posted by diamonddragon
Is there a limit above which isProbablePrime( ... ) is not sure?
The parameter p you need to pass determines the certainty of the answer of the method: 1-2^-p; if p is larger than the number of bits in the number to be checked, the method is 100% sure about its answer. There is an upper limit on p (I think it's 200).

kind regards,

Jos

6. Senior Member
Join Date
Jan 2012
Posts
210
Rep Power
7

## Re: Big prime

Does it mean number 2201 is not sure?

Page 2 of 2 First 12

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•