Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26
Like Tree2Likes

Thread: Big prime

  1. #21
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,450
    Blog Entries
    7
    Rep Power
    20

    Default Re: Big prime

    Quote Originally Posted by diamonddragon View Post
    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.
    cenosillicaphobia: the fear for an empty beer glass

  2. #22
    diamonddragon is offline Senior Member
    Join Date
    Jan 2012
    Posts
    210
    Rep Power
    3

    Default Re: Big prime

    Without Your method, he was not sure. :)

  3. #23
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,450
    Blog Entries
    7
    Rep Power
    20

    Default Re: Big prime

    Quote Originally Posted by diamonddragon View Post
    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.
    cenosillicaphobia: the fear for an empty beer glass

  4. #24
    diamonddragon is offline Senior Member
    Join Date
    Jan 2012
    Posts
    210
    Rep Power
    3

    Default Re: Big prime

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

  5. #25
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,450
    Blog Entries
    7
    Rep Power
    20

    Default Re: Big prime

    Quote Originally Posted by diamonddragon View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  6. #26
    diamonddragon is offline Senior Member
    Join Date
    Jan 2012
    Posts
    210
    Rep Power
    3

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Palindromic Prime?
    By soccergirl67 in forum New To Java
    Replies: 5
    Last Post: 12-01-2011, 09:48 AM
  2. Prime Factorization
    By skaterboy987 in forum New To Java
    Replies: 7
    Last Post: 10-27-2011, 01:18 AM
  3. Prime Number - System print all the prime numbers ...
    By pinkdreammsss in forum New To Java
    Replies: 20
    Last Post: 04-26-2009, 01:50 AM
  4. Prime numbers
    By tercius in forum New To Java
    Replies: 3
    Last Post: 05-04-2008, 06:05 AM
  5. Prime numbers
    By gapper in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 10:09 AM

Posting Permissions

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