Slashdot Mirror


Turns out, Primes are in P

zorba1 writes "Manindra Agrawal et. al. of the Indian Institute of Technology Kanpur CS department have released a most interesting paper today. It presents an algorithm that determines whether a number is prime or not in polynomial time. While I haven't gone through the presentation in detail, it looks like a promising, albeit non-optimized, solution for the famous PRIMES in P problem."

12 of 436 comments (clear)

  1. What's Polynomial Time? by Stephen+VanDahm · · Score: 2, Interesting

    I don't know anything about theoretical CS. What's polynomial time?

    Steve

  2. Crypto repercusions? by Toodles · · Score: 2, Interesting

    I am by no means a heavy duty math cruncher or cypherpunk, but how exactly is this going to affect number and factoring? I don't know of any advanced prime number search algorythms, but Sieve of Erothenes (did I get that right?) solved in NP time. (Each number is check is evenly divisible by an earlier prime, and if none found, add to list of primes, lather rinse repeat)If primes can be found in P time, finding the first 50 prime numbers would take the same time as finding the first 50 three hundred digit primes.

    While that may not be thrilling at first, let's use the RCA contest for money as an example. We get a 1024 bit number containing 200 digits in decimal formm, which is the product of exactly two prime numbers. We know then that:
    1. We only need to find one prime to easily find the other.
    2. The digits in the factors can total no more than 200 digits.
    3. One of the factors contains less than 100 digits.

    Start at 10^100 and count down using this algorythm, and youll find it in P time instead of NP time. It'll still take forever, literally and figuratively, but wouldn't it take significantly less time than before?

    Toodles

    --
    Toodles D. Clown
  3. If this turns out to be true... by angramainyu · · Score: 2, Interesting

    ...then you can bet the NSA has had this algorithm for decades.

  4. What is 'x' and how is 'q' calculated? by Mr.+Sketch · · Score: 4, Interesting

    From looking at the algo, I can't figure out what 'x' (or maybe it's a chi) is? Can someone help? I've looked it over, but couldn't find a definition of it. I'm also assuming that the 'if (r is prime)' line is a recursive call to itself? Also, how do we determine 'q' the 'largest prime factor of r-1' ? Another recursive call to get the factors? I must admit, I'm kind of lost by the algo, but it's still interesting.

  5. I'm dead tired by Henry+V+.009 · · Score: 3, Interesting

    I'm dead tired and will look at the paper in the morning. But right now I have a problem with step 6:
    "Let q be the largest prime factor of r-1"
    Won't getting q boost the thing back into power n complexity?

  6. Re:Big consequences related to encryption by mpsmps · · Score: 2, Interesting

    No, most messages will decode incorrectly.

    Consider a simple public key encryption algorithm based on the fact proved in any beginning number theory book that for primes p, q

    a^x = a (mod pq) if x = 1 (mod m)

    where m = (p - 1)(q - 1)

    Now choose your favorite number f and use Euclidean algorithm to efficiently find a number g such that

    fg = 1 (mod m)

    You may have to try another value of f if the Euclidean algorithm terminated before reaching 1, but it won't take many guesses. Now publish the number f and mod m as your public key and keep g private.

    Someone sends text t to you by sending t^f (mod m).
    Now you just raise that message to the power g and reduce mod m to recover the original text. (This follows immediately by combining the above statements).

    Finally, I'll get to the point. This algorithm is simply busted if p and q are not prime because t^fg will not equal t mod m unless you are very lucky. In fact, if you want to add a bunch of nines to your percentage certainty, just encrypt and decrypt a sample message text and verify that it works.

  7. Re:p=np? by Vengie · · Score: 3, Interesting

    3-sat isnt it 3-cnf-sat? or is cnf typically dropped?

    --
    When in doubt, parenthesize. At the very least it will let some poor schmuck bounce on the % key in vi. (Larry Wall)
  8. O(num_bits**12) time estimates by Adam+J.+Richter · · Score: 5, Interesting

    We give a deterministic O((log n)**12) time algorithm for testing whether a number is prime.

    [Sorry, the Slashdot filter does not allow me to superscript the 12.]

    The algorithm takes O(log2(n)**12) time, where n is number being factored. If we optimistically assume that this algorithm can test the primality of a 16-bit number in one microsecond, then here is how long it would take to test time primality of some larger numbers.

    • 2**12 times as long for a 32-bit number = 4096 microseconds = 4 milliseconds,
    • 4**12 times as long for a 64-bit number = 16,777,216 microseconds = 16 seconds,
    • 8**12 times as long for a 128-bit number = 68,719,476,736 microseconds = 68,719 seconds = 19 hours,
    • 16**12 times as long for a 256-bit number = 281,474,976,710,656 microseconds = 9 years.

    I don't know what a realistic base time for this algorithm really would be, and I don't know where the cross over point against existing exponential time deterministic primality testing algorithms would be, but at least this provide a sense of how log2(n)**12 grows.

  9. Re:Primality testing has never been hard by Anonymous Coward · · Score: 1, Interesting

    As has been noted, the Solovay-Strassen and Miller-Rabin tests were for all practical purposes near-deterministic polynomial-time algorithms.

    However, there is a certain stunning elegance about this new test for primality (the main loop hit me hard) that almost takes it to the level of Euclid's algorithm for GCD. A loop of the form 'while(r less than n) {...;r++;}' has an in-your-face audacity, especially when we learn that it will deterministically terminate before log(n)^3 (if I'm reading it right)!

  10. Re:for the sake of our eyes by fatbitch · · Score: 2, Interesting

    he should have used dvipdfm

  11. Re:Big consequences related to encryption by fatphil · · Score: 3, Interesting

    The PRP tests used to check numbers for compositeness or probable primality
    actually test to see if this exponentiation procedure works.

    RSA does work with carmichael numbers instead of primes, for example, because

    a^c == a (mod c) for all a s.t. (a,c)==1, c a carmichael number

    Try it - it works!

    Phil

    --
    Also FatPhil on SoylentNews, id 863
  12. This fact is not new... by mgessner · · Score: 2, Interesting

    I wrote a paper back in 1990 about a prime number sieve that was basically an O(n^2) algorithm.
    It basically worked by finding out if numbers were composite, but the algorithm used could be "inverted" to tell you if a number was prime or not by telling you if it was composite or not.
    It was very well suited to parallel implementations, too.

    --
    "Sometimes the truth is stupid." - Lawrence, creator of Prime Intellect