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."

116 of 436 comments (clear)

  1. for the sake of our eyes by fatmav · · Score: 5, Informative

    the ps version looks much better:
    http://www.cse.iitk.ac.in/primality.ps

    --
    // FIXME: put sig here
    1. Re:for the sake of our eyes by fatbitch · · Score: 2, Interesting

      he should have used dvipdfm

    2. Re:for the sake of our eyes by Soft · · Score: 2
      pdflatex doesn't always work - try it with prosper slides for instance - and the times package is obsolete.

      Either use package txfonts or maybe pxfonts (uses only PostScript fonts), or mathptmx (keeps Computer Modern fonts for math, but this doesn't always work), or install the vectorial T1 version of the ECM fonts and make sure those are used instead of the bitmap ones.

    3. Re:for the sake of our eyes by the+way,+what're+you · · Score: 2

      apparently it's been moved:
      http://www.cse.iitk.ac.in/news/primality.ps

      --
      example.org - powered by Linux!
  2. What's Polynomial Time? by Stephen+VanDahm · · Score: 2, Interesting

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

    Steve

    1. Re:What's Polynomial Time? by orz · · Score: 2

      They're saying the the time T necessary to determine whether or not an N digit number is prime satisfies this equation:

      T a)
      for some value (can be any finite value) of k and a.

    2. Re:What's Polynomial Time? by Goonie · · Score: 5, Informative
      The technical definition is kinda long and complex, but in essence it's like this. Given a problem of some size n, a polynomial time algorithm is guaranteed to give a solution in time proportional to a polynomial of n. If a polynomial-time algorithm exists that solves a problem, then the problem is said to be in polynomial time.

      To give an example, say you've got a list of numbers and you want to know the sum. That can be done in linear time - ie, the time taken is proportional to the length of the list of numbers. The size of the problem (n) is defined by the length of the list and the time taken (T) is as follows: T = c1 * n + c0, where c1 and c0 are some fixed constants. The formula for T is a polynomial, and so the problem "LIST-SUM" is in polynomial time. It would still be in polynomial time if the formula for T was a polynomial with n^2, n^3, n^50 terms in it, or even terms like n^1.5 (because as n grows very large an n^1.5 term will always be smaller than an n^2 term).

      Showing you an example of something outside polynomial time is a little more difficult, but some standard examples are SAT (the satisfiability problem) or the travelling-salesman problem, which you can read about in any book on the subject.

      --

      Any sufficiently advanced technology is indistinguishable from a rigged demo
      --Andy Finkel (J. Klass?)
    3. Re:What's Polynomial Time? by jeffy124 · · Score: 2, Informative

      a simple way to think of it:

      an NP-complete (NP=non-polynomial) problem is one that can be solved, but takes about 8*age_of_universe time to solve. To get around this, approximation algorithms are used, but these can never give a 100% guarantee of finding the correct solution, nor may provide the same solution if it were to execute on the same data twice.

      a polynomial-time problem is one that can be solved within our lifetimes, guarantee 100% accuracy, and can always generate the same solution for the same data.

      there's a LOT more to it. The book Intro to Algorithms has a good chapter on the topic of NP-completeness, which will explain the intricate and gory details.

      --
      The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
    4. Re:What's Polynomial Time? by platipusrc · · Score: 2, Informative

      NP stands for Nondeterministic Polynomial.

      ie, it can be completed by a nondeterministic machine in polynomial time. The main problem with NP algorithms is that there aren't any nondeterminisitic machines around. (A nondeterministic machine can attempt all paths to try to reach a conclusion at once whereas a deterministic machine can only try one at a time.)

      --
      And the muscular cyborg German dudes dance with sexy French Canadians
    5. Re:What's Polynomial Time? by Kaz+Riprock · · Score: 4, Funny
      Back in the days of parachute pants, leg warmers, and the 80's, there was a man....a man with a rapping and dancing vision. His name...

      MC Polynomial.

      And he sang a song..."P can't Touch This". Before the drum break of this song, Poly sang:

      It's a prime, because you know
      P can't touch this
      P can't touch this
      Stop...Polynomial Time...

      Thus giving rise to a branch of mathematical order functions denoting the complexity of a problem...

      Either that or it's defined pretty well here.

      --
      Mordor...a magical, mythical land where women are more rare than dragons--but where every man would rather find a dragon
    6. Re:What's Polynomial Time? by Goonie · · Score: 3, Informative
      Well, there are things that are definitely outside polynomial time - the halting problem for instance, which is undecidable no matter how much time you have. There are also problems that provably take exponential time even on a nondeterministic Turing machine. However, you are quite correct that TSP or SAT just might be in P (but it's pretty damn unlikely).

      I was trying to keep it simple because the original poster said that he didn't know anything about theoretical CS.

      --

      Any sufficiently advanced technology is indistinguishable from a rigged demo
      --Andy Finkel (J. Klass?)
    7. Re:What's Polynomial Time? by Salsaman · · Score: 5, Funny
      There is a remote island in the South Pacific called 'Polynosia' (not to be confused with 'Polynesia').

      The island has a number of strange customs.

      1) All the women on this island are called 'Polly' in reverence to the island's god, Polynose.

      2) The men of the island are very philosphical (maybe because all the women are called Polly, so it gets very confusing). They spend most of their time poring over mathematical problems.

      3) The island has strict laws on the use of technology. Telephones are not allowed, aircraft are not allowed to land there, in fact the only way to reach the island is by boat, nevertheless it is very popular with tourists.

      4) It is considered offensive to Polynose for anyone who is not a Polynosian woman (a Polly) to prepare food. Since the island is popular with holiday makers though, all of the enterprising Polly's have opened small restaurants called 'Polly-meal-time'.

      The men of the island, in order to discuss their mathematical musings, recently opened a cafe. To distinguish this from all the restaurants, they named it 'Polly-no-meal-time'.

      The article reports that recently a boatload of mathematicians visited Polynose, and told the island's men how to check if a number is prime.

      Thus the headline 'Primes can now be solved in Polly-no-meal-time'.

      /me ducks :-)

    8. Re:What's Polynomial Time? by phliar · · Score: 2
      NP=non-polynomial
      Wrong. NP is the class of "non-deterministic polynomial-time" algorithms.

      Another way to think about it is: can a proposed solution to the problem be checked (deterministically, of course) in polynomial time?

      an NP-complete problem is one that can be solved, but takes about 8*age_of_universe time to solve
      Wrong again. If you have a class C, the class "C-complete" represents something like the kernel of class C -- roughly, if you can solve a problem in C-complete defined under some restrictions, then you can solve any problem in C under those restrictions. Example: if you can solve a problem in NP-complete -- say 3-SAT -- in P time, then you can solve any problem in NP in P time.
      a polynomial-time problem is one that can be solved within our lifetimes
      Not encessarily. An n^{large-number} is not realistic to use for any non-trivial n. Anything above a cubic is not really usable.

      --
      Unlimited growth == Cancer.
    9. Re:What's Polynomial Time? by Jay+L · · Score: 2

      Not to be confused with MC Hawking.

  3. Re:I always thought is was in P by Anonymous Coward · · Score: 5, Informative

    For P, it has to be polynomial in the size of _the input_. The input size here is log(n) since it requires log(n) bits to represent n. log(n)^12 hence is polynomial (which i believe their algo guarantees), whereas sqrt(n) is not.

  4. Re:Nobel Prize Time by RackinFrackin · · Score: 2, Informative

    If I'm reading this correctly, we've got a nearly guaranteed winner of the Nobel Prize here.

    This would be more in line for a Fields Medal than a Nobel Prize.

  5. Re:I always thought is was in P by Walker · · Score: 3, Insightful

    What are you referring to as your input size n in O(n)? The number p? The correct size n is the number of digits of p. That algorithm is definitely non-polynomial for that (correct) n.

  6. 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
    1. Re:Crypto repercusions? by mlc · · Score: 2
      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?

      Ah, no. First, note that a 2^1024-big number has more than 300 decimal digits, and so a 2^512-big number has more than 150. Then, even if primality testing took only 1 operation, we'd still need to perform something like 2^511 operations by your method. At 10^24 (one trillion trillion; unfathomably many) operations per second, this'd *still* stake 10^112 times longer than the estimated lifetime of the universe (1.5*10^10 yrs) to complete!

      There are, however, faster ways of factorization than testing all the numbers in (1..sqrt(N)) to see if they are factors of N. They are not noted in (or relevant to) the paper mentioned by this article.

      [nb: See other comments for why this is, in *practical* use, not such a big improvement on Miller-Rabin and other randomized methods which have been known for decades.]

    2. Re:Crypto repercusions? by khuber · · Score: 2, Informative
      Don't you mean 9000000.....?

      -Kevin

    3. Re:Crypto repercusions? by a_n_d_e_r_s · · Score: 2

      Sorry, you are right the number should be a 8 followed by a large number of nines.

      The answer for 10 and 100 is of course 89.

      --
      Just saying it like it are.
  7. mod parent up by orz · · Score: 2

    it's the only correct reply so far

  8. Re:Nobel Prize Time by EvanED · · Score: 2

    What category? Unfortunately, there's no mathematics Nobel Prize. I realize that they consider applications, but I don't see many in physics, chemistry, medicine, economics, peace, or literature.

  9. If this turns out to be true... by angramainyu · · Score: 2, Interesting

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

    1. Re:If this turns out to be true... by danro · · Score: 2

      ...or not working in the US at all.

      --

      "First lesson," Jon said. "Stick them with the pointy end."
  10. Re:Big consequences related to encryption by God!+Awful · · Score: 5, Funny


    Well, encryption based on the multiplication of large primes, anyway.

    Yeah... that step in key generation where you check whether a candidate key is prime or not will now be performed with 100% confidence instead of that annoying 99.999999999999999% confidence we used to have.

    -a

  11. Oops. HTML by orz · · Score: 2

    They're saying the the time T necessary to determine whether or not an N digit number is prime satisfies this equation:

    T N ^ k + a

    for some values (can be any finite value) of k and a.

    Basically, it's a statement about how well an algorithm scales to REALLY large numbers.

  12. arg. I did it again by orz · · Score: 3, Informative

    hm... I'm not sure why it removes comparison symbols when set to plain text... oh well, I wrote out "is less than" this time

    They're saying the the time T necessary to determine whether or not an N digit number is prime satisfies this equation:

    T is less than N ^ k + a

    for some values (can be any finite value) of k and a.

    Basically, it's a statement about how well an algorithm scales to REALLY large numbers.

  13. Factoring might still be NP by IntelliTubbie · · Score: 5, Informative

    For those of you wondering about the implications for cryptography, this does not imply that composite numbers can be factored in polynomial time. This algorithm is simply a primality test -- that is, it tells you whether or not a number has any proper divisors (in polynomial time), but it doesn't tell you what these divisors actually are. Determining whether a number is prime has always been considerably easier than finding the prime factorization.

    In fact, for schemes like RSA -- where the key is the product of two large primes -- we already know that the number is composite, by definition, so a more efficient primality test doesn't give us any new information.

    Cheers,
    IT

    --

    Power corrupts. PowerPoint corrupts absolutely.

    1. Re:Factoring might still be NP by EJB · · Score: 2

      Key generation for algorithms like RSA already use numbers that are prime with a high probability. There are quick algorithms for that. But key generation algorithms currently don't run for several months to ensure for 100% that the factors are prime.

      So perhaps this algorithm makes RSA, DSA, etc. even stronger because it will be easier to guarantee that the factors are prime instead of assuming it with 99,999999999999% probability.

    2. Re:Factoring might still be NP by Dan+D. · · Score: 2

      however this could help with choosing those two large primes for RSA (although I think the algorithms used these days are already highly efficient at finding relatively prime numbers which is all that actually matters)

      --
      People who quote themselves bug the crap out of me -- Me.
    3. Re:Factoring might still be NP by epsalon · · Score: 2

      This is a common mistake about probabilistic algorithms. Primes was up to now known to be in ZPP. That means there is a polynomial time algorithm that has > 2/3 chance of answering correctly, and 1/3 chance of not answering, independent between trials.

      Thus, to check primality, we simply employ this algorith until it answers, and then we could be sure of the answer. This could theoretically take a long time if you are extremely unlucky, but realistically, there's a bigger chance of you suddenly reappearing in China.

  14. Re:Big consequences related to encryption by DavidTC · · Score: 2, Insightful
    Of course, there's still a larger chance of a cosmic ray flipping a bit in the processor or memory then the math being wrong, anyway. ;)

    This may seem like a strange question, but isn't a non-prime that passes the 99.99999999999% check just as good as a prime in encryption? I mean, seriously, is anyone really going to notice it's not prime? Sure, they could accidently stumble on the 'wrong' factors while trying decode it, but, seriously, halving the time to decode your message isn't a huge mistake, considering we're talking on the order of centuries at least. ;)

    --
    If corporations are people, aren't stockholders guilty of slavery?
  15. 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.

    1. Re:What is 'x' and how is 'q' calculated? by matrix0040 · · Score: 3, Informative

      no you dont need recursive call. as r is O(log(n)) so size of r is O(log log(n))) so if an exponential time algorithm is used for checking the primality of r, it'll be exp in log(log(n)) i.e. linear in log(n)

      Same goes with q. as it's "small" you can afford an exponential algoritm.

      also x is a variable, those eqns (12) really are polynomial eqns.

    2. Re:What is 'x' and how is 'q' calculated? by deblau · · Score: 4, Informative
      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.
      OK, I'll address these points in order:

      First off, 'x' doesn't matter. The loop at the bottom checks a congruence of two polynomials over two finite rings (if I'm reading it right, the first is generated by x^r-1 and the second by the input n). Simplistically, this amounts to grinding out the coefficients of the two polynomials and verifying that the difference of the polys equals zero, modulo the ring generator. The actual 'value of x' is never used.

      Second, if you check the order statistic calculation, they're assuming worst-case on factoring 'r' (they apply order r^1/2 for that factorization). They then make an assumption that O(r^1/2) = O((log n)^3), or that O(r) = O((log n)^6), which seems rather suspect (as if they knew the answer ahead of time and plugged in a recursive value for it). Nevertheless, they do go to some length to show that such an r exists, and that it requires at most O((log n)^6) iterations of the first loop to find it.

      As for 'q', I think again it is determined by brute-force factoring r-1. On the one hand, r is small; on the other hand, that doesn't mean a damn thing when it comes to dealing with order statistics, which I think is also a little suspect.

      --
      This post expresses my opinion, not that of my employer. And yes, IAAL.
    3. Re:What is 'x' and how is 'q' calculated? by fatphil · · Score: 2

      x is just a symbol. The proof is performed using polynomial ring.

      Doing shit modulo (x^r-1) means that as soon as you multiply your
      polynomials together and get any terms over x^(r-1) you can replace
      x^(r+d) with x^d, because (x^(r+d)-x^d) == 0 (mod (x^r-1))

      e.g. modulo x^2-1

      (ax+b)^2 == a^2x^2 + 2abx + b^2 == (2ab)x + (a^2+b^2)

      FatPhil

      --
      Also FatPhil on SoylentNews, id 863
  16. Funny by Alizarin+Erythrosin · · Score: 2, Informative

    It's funny when I read the comments, and I see all kinds of stuff that reminds me of my Discrete Structures class (we did the P and NP stuff at the end)...

    Makes me wonder what this means for computer theory, but if you think about it, polynomial time can still be slow for very large n with very big powers... although not as bad as an exponential with large n's (assuming you go out far enough that the exponential will grow faster then the polynomial)

    Kudos to the team that discovered this

    --
    There are only 10 kinds of people in this world... those who understand binary and those who don't
  17. I don't think so. by orz · · Score: 2

    Cracking any specific key-length is P, but cracking RSA in general remains NP, since that method requires checking a number of potential primes proportional to 2^(N/2) or so where N is the key size.

  18. Re:If this is true... by ipfwadm · · Score: 5, Informative

    They could have easily taken over the infrastructure of a modernized computer-bent, encryption-shielded society such as the US or Japan.

    Primality testing and factorization are not one and the same. It is possible to know that a number is not prime without knowing its factors. Breaking encryption requires factoring the product of two huge primes (it is already known that the number you're trying to factor is NOT prime, so Primes being in P is more or less useless by itself for this particular application), and factorization has yet to be shown to be in P.

  19. 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?

    1. Re:I'm dead tired by Henry+V+.009 · · Score: 2

      I took a second look, and I'm pretty sure about it. To complete this algorithm for n, for every prime rn, you will need to find the largest prime factor of r-1.

    2. Re:I'm dead tired by matrix0040 · · Score: 3, Informative

      no it wont as q is "small", as proved in lemma 4.2 r is O(log(n)^6) and so is an upper bound on q. so the size of q is O(log(log(n)) and an exponential time in that will be linear in log(n) !!

  20. If you're confused by "P" and "NP".... by Erpo · · Score: 5, Informative

    look here.

  21. Implications by davemarmaros · · Score: 5, Informative

    There are 2 different problems:
    1) Determining if a number is prime [is 909 prime?]
    2) Determining the factors of a number [what are the factors of 909?]

    This article claims to be able to solve problem 1 in Polynomial time.

    However, problem 2 is MUCH harder, and that is the one which will break cryptography as we know it. This article does not claim to solve problem 2, so we're safe for now.

    1. Re:Implications by Indras · · Score: 2

      1) Determining if a number is prime [is 909 prime?]

      Here, quick math trick that will save people a bit of time. It's always easy to tell if a number is divisible by three, just add all the digits together, and if the result is divisible by three, then so is the original number. 909 = 9 + 0 + 9 = 18 (divisible by three). Oh, and you can take it a step further (18 = 1 + 8 = 9) if the result is still too long.

      Therefore, this number showed up right away to me as being divisible by three, and quick division will show that 303 * 3 = 909.

      --
      The speed of time is one second per second.
    2. Re:Implications by ryanvm · · Score: 2

      However, [determining the factors of a number] is MUCH harder, and that is the one which will break cryptography as we know it.

      Not all public-key cryptography is based on the difficulty of factoring numbers. There are a number of other one-way functions (such as elliptic curves) that are being used in cryptography. So I wouldn't say it'll break crypto "as we know it", but it would certainly freak some people out.

    3. Re:Implications by timster · · Score: 2

      This proof is by spontateous invention, so don't sue me if it's screwed up someplace. There's probably a much simpler proof, but proof by induction is fun. Note that I'm assuming base 10, and this obviously doesn't work in other bases.

      Start with the first multiple of 3: 3. As this is one digit, obviously the sum of all its digits is divisible by three. Consider this a basis case for induction.

      When we add 3 to a number that is divisible by three, either we have to perform a carry, or we don't. If we don't, then the addition operation will add exactly three to the sum of the digits. Since we know (from our induction assumption) that the sum of the digits is already divisible by three, obviously adding three to that sum creates another multiple of three.

      If we have to perform a single carry into the tens place (say 9+3=12), then the sum of the digits excluding the ones place increases by 1, and the value of the number (ignoring the ones place) increases by 10. Since we're adding three, obviously the value of the ones place always has to decrease by seven. 1-7=-6, so this operation always subtracts 6 from our total digit sum. Obviously subtracting 6 from any number that is already a multiple of 3 yields another multiple of 3.

      What if the carry is compound (99+3=102, or 999+3=1002)? Since we're only adding 3, any place that is affected by the compound carry will have to be a 9. The 9 will always change to a 0. Subtracting nines doesn't hurt our multiple of 3, so we can ignore it. Then, the value of the first place that isn't a 9 will increase by 1, which makes this ultimately the same as the case in the above paragraph.

      Thus, the first multiple of 3, 3, has digits that add up to 3, and adding 3 to a multiple of 3 whose digits add up to a multiple of 3 will create a number whose digits sum to a multiple of 3. So by induction, all multiples of 3 have digits that add up to a multiple of 3.

      --
      I have seen the future, and it is inconvenient.
    4. Re:Implications by kallisti · · Score: 2
      Got a proof for this?

      Here's a less formal, but possibly easier to understand proof. When you shift a digit, what you are doing is making 10^n * a into 10^(n-1)*a, the difference is therefore:
      a * 10^n - a * 10^(n-1)
      a * (10^n - 10^(n-1))
      a * (10^(n-1) * 10 - 10^(n-1))
      a * 10^(n-1) * (10 - 1)
      a * 10^(n-1) * 9
      Since this number is divisible by 3 (not to mention 9) shifting a digit right is equivalent to subtracting out a bunch of 3s, which won't affect the result of the division. This is why adding the digits is also known as casting out nines.

    5. Re:Implications by schon · · Score: 2

      This is why adding the digits is also known as casting out nines.

      I thought that "casting out nines" was a reference to the fact that you can (quickly) find the recursive sum of any series of digits by eliminating every multiple occurrence of the number 9?

    6. Re:Implications by kallisti · · Score: 2

      In school I read a book called Magic House of Numbers by Irving Adler. In that book, adding digits was referred to as casting out nines. Sadly, the book is out of print as it is an excellent collection of math factoids and classic puzzles. I reread over every few years in school and always got more out of it.

  22. Re:Cryptography by God!+Awful · · Score: 3, Informative


    Out of interest, will this finding have any impact on the effectiveness of present day cryptography?

    Probably not. While it is possible that this research could lead to results in speeding up factoring, a faster algorithm for determining whether a number is prime is not going to compromise the security of RSA.

    Your RSA key pair is derived from 2 large primes. The way we generate keys is to randomly test large random numbers to see if any of them are prime. Ergo, we must already have an efficient formula for determining if a number is prime or not.

    FYI, the most commonly used algorithm is Euler's formula. Euler's formula doesn't actually tell you if a number is prime, but it will usually give a non-zero output if the number is not prime, so if you run it enough times with different inputs, you can be 99.99999% sure that a number is prime. However, a small percentage of numbers are "pseudoprimes" -- numbers that are not prime but which will also satisfy Euler's formula. Therefore, after you discover a candidate prime, you should use a different (slower) formula to double-check.

    Since this is fairly common knowledge among geeks who use encryption, I'm somewhat surprised that so many people here jumped to the same conclusion you did.

    -a

  23. Re:Big consequences related to encryption by jpmorgan · · Score: 2

    Maybe, maybe not. If that non-prime happens to be 2^2031, I bet it'll make your encryption really weak. ;)

  24. Re:Big consequences related to encryption by Goonie · · Score: 3, Insightful

    Uh, no. Just because you can tell whether a number is prime in polynomial time, doesn't mean you can find the factors of a number in polynomial time, as I understand it.

    --

    Any sufficiently advanced technology is indistinguishable from a rigged demo
    --Andy Finkel (J. Klass?)
  25. Re:Oh yeah? Well... by braindead · · Score: 3, Funny
    • I have developed an algorithm that will determine if any number less than a google is prime in O(1). Above a google it degrades pretty fast, though.

    Aha... is that based on a precomputed sieve with 10^100 elements, by any chance? ;-)

    (it's googol, by the way. Google.com is obviously not prime, based on the fact that they haven't IPO'd yet)

  26. Re:Big consequences related to encryption by tbo · · Score: 5, Insightful

    Thank you. I'm glad someone finally pointed out that we already have a classical (as opposed to quantum) probabilistic algorithm for determining primality. Every other fool on this board is running around wearing his/her tin hat and shouting about RSA being defunct. All this does is push primality testing from the BPP complexity class into the P complexity class. It is significant in the sense that it weakens the argument for BPP being larger than P.

    Of course, we also have a polynomial-time algorithm for prime factorization (Shor's Algorithm). It's just that it requires a quantum computer, which is difficult to build. So far, the biggest number factored is 15... 1024 bit keys will be safe for a while yet. I believe it's 15 - 20 years until they're broken, if Moore's Law holds for quantum computers in terms of maximum number of qubits possible (so far, it roughly has, but then, we're only at about 7 qubits).

  27. Ignore parent by God!+Awful · · Score: 2

    Ignore the parent post, since it is wrong. The previous poster did a much better job of explaining the concept of polynomial time.

    An NP-complete problem does not take 8 times the age of the universe to solve. This completely missed the point. Every P or NP problem can be expressed in terms of a variable "n", which represents the input size. There are many practical problems where the best-known P algorithm is slower than the best NP algorithm for typical values of n. However, computational theory tells us that as n increases, the P algorithm will eventually beat the NP one.

    -a

  28. Re:Oh yeah? Well... by Kwikymart · · Score: 2

    google v. [common] To search the Web using the Google search engine,
    `www.google.com'. Google is highly esteemed among hackers for its
    significance ranking system, which is so uncannily effective that many
    users consider it to have rendered other search engines effectively
    irrelevant. The name `google' has additional flavor for hackers because
    most know that it was copied from a mathematical term for ten to the
    hundredth power, famously first uttered by a mathematician's infant
    child.

    ---------

    googol
    n : a cardinal number represented as 1 followed by 100 zeros
    (ten raised to the power of a hundred)

    There is a HUGE difference between the two.

    --

    Buying a Dell computer is equivalent to dropping the soap in a prison shower.
  29. We already knew that... by FalafelXXX · · Score: 5, Informative
    The famous result by Miller 1976 (and indepdently rediscovered(?) by Rabin 1980) already did that. The only difference is that their algorithm was in RP (randomized polynomial). Namely, if the algorithm says it is prime it might be wrong (with probablity half, say), and if it says that the number is not prime, then it is not prime for sure.

    Now, if you have a number n, you run this algorithm, say 20*log(n) times. If the algorithm says it is prime on all executions that it is prime, you know damn sure it is. If it says it isn't, you are sure it isn't. There is a rediclously tiny probablity that if the algorithm claims that it is prime in all executions, that it is still not prime. This probablity is so small, that it can be essentially ignored. Now, random bits are cheap nowadays, so this is quite satisfactory. This is in fact the algorithm that turned the RSA crypto system into a practical and useful algorithm, because suddently finding primes became easy.

    To break RSA, and become really famous, one has to come up with a polynomial time algorithm for factoring. It might even be that RSA can be broken without factoring, but this is still an open question (I think).

    Ahh, and BTW. Polynomial time means polynomial time in the size of the input. So if the number is n, the size of the input is O(log(n)), and the running time needs to be O( (log(n))^(O(1)) ).

    Ok. End of boredom.

    1. Re:We already knew that... by spitzak · · Score: 2

      Does anybody know what happens to RSA if in fact one of the "prime" numbers is not prime? My guess is that this does not make it suddenly easy to break, or make it fail to encode (because either of those would imply a fast way to determine if a number is prime by seeing if it works in RSA). I would guess that a tiny fraction of messages would decode to garbage rather than to the desired text, but does anybody know for sure?

    2. Re:We already knew that... by fatphil · · Score: 2

      I think you're missing the point of Rabin's test.

      Rabin's test says that if there is no witness below 2ln^2(n), then the
      number is certainly prime.
      The repeated-by-a-fixed-small-number PRP-test MR test is still a
      compositeness test, or a Probable Primality test, and does not give a
      certain answer.

      A PRP is not _proven_ prime.

      See professor Caldwell's Prime Pages at:
      http://primepages.org/

      FatPhil

      --
      Also FatPhil on SoylentNews, id 863
    3. Re:We already knew that... by zenyu · · Score: 2

      Yeah, in fact someone told me about a determinastic polynomial algorithm almost a year ago. Maybe he was a reviewer for this paper, I dunno. But I assume someone more knowledgable will pipe up on this eventually. What I know is that there are some known composites that look like primes to the Miller and Rabin algorithms, and they can wreak havock to encryption. I think there is a test for these, but there may be more of em out there. Carmichel is the name that pops in my head, but I'm probably wrong.

      In anycase, for cryptography you would probably run the randomized algorithm on a bunch a numbers until you found a number to be a prime with high probability, then you would run this to verify that it is a prime with higher certainty. The certainty sorta depends on the length of the proof for this algorithm. Since for a sufficiently complex proof there is a non-zero probability that the proof is not correct, and the probabilistic algorithms often have simple proofs that we may be more certain of.

    4. Re:We already knew that... by Mornelithe · · Score: 5, Informative
      I probably really shouldn't be replying, because it's been a while since I read how it works, but I can copy the algorithm and tell you where I think it would break (if at all). Please correct me where I'm wrong.
      1. Generate two random primes p and q
      2. Calculate n = pq and phi(n) = (p - 1)(q - 1) = n - (p + q) + 1 (Note: phi(n) is the number of primes less than n (Euler's totient function, I believe). phi(p) = p - 1 for prime p, and phi(pq) = phi(p)phi(q) for p relatively prime to q (note, this step breaks if p or q aren't prime))
      3. Generate e
      4. Calculate d, the inverse of e (mod phi(n)) (i.e. d*e = 1 (mod phi(n)))
      5. is the enciphering key, is the deciphering key
      6. For plaintext P, you get ciphertext C by doing: C = P^e mod n, and get P back by doing P = C^d mod n

      So, now there's the matter of why it works. Here we go:

      • Because of Fermat's Little Theorem, we know that a^(phi(n)) = 1 (mod n)
      • Since ed = 1 (mod phi(n)) we have: ed = 1 + k*phi(n) for some integer k
      • So, if we encipher and decypher, we have: (P^e)^d = P^(ed) (mod n)
      • Which also means we have: P^(1 + k*phi(n)) = P*(P^(k*phi(n))) = P*((P^phi(n))^k) = P*(1^k) = P (mod n)

      So when p or q are not prime, phi(n) != (p - 1)(q - 1), so when you calculate d, you'll get something that doesn't negate the encrypting process (because its not a multiplicative inverse mod the real phi(n)), so you'll probably get junk when you decipher.

      I don't really feel like doing a detailed analysis of the algorithm, but I imagine that this isn't used as a primality test because it's running time probably isn't polynomial time.

      --

      I've come for the woman, and your head.

    5. Re:We already knew that... by Alsee · · Score: 2

      Only if using binary to represent the number.

      Nope. You need to learn what O() means.

      He never said log2(n). He said log(n) without a base. O() measures what happens when n gets arbitrarily large and the statements are true for ANY fixed base. That's why no base it given, it is irrelevant. The difference between log2(n) and log10(n) is a fixed factor of 3.3. The O() of a problem tells you weather it takes you microseconds or gigayears to solve it. There really isn't any meaningful difference between 1 microsecond and 3.3 microseconds, or between 1 gigayear and 3.3 gigayears.

      And here's the kicker: Nothing prevents me from using a base equal to the number itself.

      As I said, O() measures what happens when n gets arbitrarily large. If you are using an arbitrarily large base then what you've got is a quantum computer. This problem and the harder problem of actually finding the factors have already been proven solvable in polynomial time for quantum computers.

      -

      --
      - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
    6. Re:We already knew that... by plaa · · Score: 2, Informative

      (Note: phi(n) is the number of primes less than n (Euler's totient function, I believe). phi(p) = p - 1 for prime p, and phi(pq) = phi(p)phi(q) for p relatively prime to q (note, this step breaks if p or q aren't prime))

      A slight error: phi(n) is the number of positive integers less than n, which are relatively prime to n (ie. gcd(n,x)=1). Therefore, if p is a prime, it is also relatively prime to all smaller integers, so phi(p)=p-1.

      The function that tells the number of primes smaller than n is pi(n), the prime counting function.

      Refs: Totient Function Prime Counting Function (MathWorld's luckily back online!)

      --

      I doubt, therefore I may be.
    7. Re:We already knew that... by thogard · · Score: 2

      When you build a key with from two primes you have two keys that work, one is private and one is public.

      When you build a key with three primes you have one public key, one private key and two that will work for the hackers.

      When you build a key out of four primes you end up with the two keys you expect and 6 or 9 others.

      You can do this by building your own RSA like system with 32 bit keys and plug in some small random even "prime" and see how many other keys work.

      Not all keys work but some of the combos will.

    8. Re:We already knew that... by thogard · · Score: 2

      All primes above some low number of digits are pseudo-primes. Pseudo-primes aren't proven prime by attempting to factor all numbers smaller than it, but are proven by a number of tests that seem to indicate that the number is prime.

      For testing why things break because you can factor a supposedly prime number, an even number will work as well as any other and its sure speeds up the factoring if you have to do it by hand.

      Knuth has some interesting bits on this in his books.

  30. 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.

  31. Primality testing has never been hard by sasami · · Score: 5, Informative

    This result, if true, is very interesting from a theory standpoint.

    As far as practice, it's fairly irrelevant. Probabilistic primality testing can be done in constant time with bounded error.

    The Miller-Rabin test will tell you if a number is prime with at most 1/4 probability of error. That sounds ridiculous, but the catch is that you can iterate it using a random parameter. Do the test twice and your probability drops to 1/16. Do it fifteen times and your chances of being wrong are about one billionth.

    If you're truly paranoid, do it 50 times. That'll bring the error rate of the algorithm magnitudes below the error rate of your hardware.

    ---
    Dum de dum.

    --
    Freedom is not the license to do what we like, it is the power to do what we ought.
    1. Re:Primality testing has never been hard by Alsee · · Score: 2

      If you're truly paranoid, do it 50 times. That'll bring the error rate of the algorithm magnitudes below the error rate of your hardware.

      Depending upon what version Pentium CPU you're using you can accomplish that with 2 or 3 steps.

      Old joke, but couldn't resist :)

      -

      --
      - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
    2. Re:Primality testing has never been hard by Kynde · · Score: 2

      The Miller-Rabin test [mit.edu] will tell you if a number is prime with at most 1/4 probability of error. That sounds ridiculous, but the catch is that you can iterate it using a random parameter. Do the test twice and your probability drops to 1/16. Do it fifteen times and your chances of being wrong are about one billionth. If you're truly paranoid, do it 50 times. That'll bring the error rate of the algorithm magnitudes below the error rate of your hardware.

      Just consider how fast it's on some of the better known commercial operating systems, because even that 1/4 error probability is magnitudes below the error rate of your platform

      --
      1 Earth is warming, 2 It's us, 3 it's royally bad, 4 we need to take action NOW
    3. Re:Primality testing has never been hard by bluGill · · Score: 2

      What nobody knows though is if error is good or bad. If Miller-Rabin says a number is prime, and you use it for an application that requires a prime number, the application will still work. At least that is true for all the applications I know of that require a prime number (Public Key Encryption), there are probably others.

      I've speculated that the existance of non-primes that work is one of the things that makes public key encryption hard enough to be useful. I can't prove it though, and offer it only as an interesting (but likely wrong) point to consider.

    4. Re:Primality testing has never been hard by Kynde · · Score: 2

      What a load of crap...

      What nobody knows though is if error is good or bad. If Miller-Rabin says a number is prime, and you use it for an application that requires a prime number, the application will still work.


      Not necessarily, and even when it does, incase it indeed is not a prime it may very well be attackable, even significantly. Although, when Miller-Rabin says one in 10^50, it means that the odds really are that low, and as it's way beyond your hardware reliability, who cares if it's actually false or not.


      I've speculated that the existance of non-primes that work is one of the things that makes public key encryption hard enough to be useful. I can't prove it though, and offer it only as an interesting (but likely wrong) point to consider.


      There are numbers that fool the gaussian test for primes, so called Carmichael numbers. There are also composite numbers (i.e. nonprimes) that pass Miller-Rabin test, therefore for example in Mathematica the Miller-Rabin test is combined with Lucas pseudoprime test. Though, it may still fail, it's sufficiently unlikely.

      BUT how the fsck can you say that "the existance of non-primes that work is one of the things that makes public key encryption hard enough to be useful" ???
      Public key cryptography IS being used, and a lot! And on top of which, the smallest problem with it is the generation of primes.

      There are "problems" with it, the unawareness wether there actually is a P complex factorisation algorithm yet to be discovered. Also from a steganographical point of view, RSA has somewhat detectable bias, although it's usually being used just transmit the key for some symmetric proven-to-be-strong cipher, which inturn is used to encipher the actual message.

      --
      1 Earth is warming, 2 It's us, 3 it's royally bad, 4 we need to take action NOW
  32. Re:I always thought is was in P by crlf · · Score: 2

    Uhh..

    Pardon my french, but isn't sqrt(n) is better than log(n)^12?

  33. Re:I always thought is was in P by crlf · · Score: 2

    I hate replying to my own posts, but upon further inspection, I realized that sqrt(n) > log(n)^12 for large n.

    Yet, sqrt(n) is still polynomial time.

  34. Re:arg. I did it again by shepd · · Score: 2, Informative

    >I'm not sure why it removes comparison symbols when set to plain text...

    Slashdot removes left angle brackets in an attempt to stop abuse. Since it still lets raw right angle brackets through for old style quoting (which I prefer), the left ones have to go on unverified tags.

    To display a left angle bracket despite that you'll need to type its ISO code, which renders the bracket unusable for tags (which is a good thing).

    ie: < is entered with this: &lt;

    Just something to note down FFR. Oh, and &nbsp; can be handy if you want to try to slip through some important, on-topic simple tables or ascii art. Sometimes. But not lately.

    - o
    <
    \__/

    --
    If you could be told what you can see or read, then it follows that you could be told what to say or think - BoC
  35. MrByte's 1 Page P, NP, NP-Complete Primer by MrByte420 · · Score: 2, Informative

    So I'm already sensing the level of confusion rising as this is a very confusing topic. Here's a quick review. Note: I'm going to do this on a higher level and not start talking about Formal Languages as this is not the place to teach it. So in loose terms, Problems that in P are easily solveable. For example, sorting is a problem in p. Proof: I can sort a set of n numbers in no worse than n^2 time using a bubble sort. (Yes - I know there's faster but this is an example). The bubble sort just compares every number to every other number. Assuming you didn't optimize the algorithm you'd compare each number to every other number and they'd be sorted in no worse than n*n = n^2 comparisons. So what is NP? NP are problems that given a proposed solution we can verify that the solution is correct or not in polynomial time. An example of this is factoring. (note: it is not known whether factoring is in P). Given current methods we know factoring a big number into its prime factors. But if I was to tell you that p=q*r you could very quickly multiply q*r and see if it is equal to p and "verify" my answer. Another way to think about it is you can try out one branch of computation in polynomial time. So what is NP-complete? NP complete problems are is follows. A problem is NP-Complete iff 1) The problem is in NP 2) A solution in polynomial time to this problem would yield a polynomial time solution to all other problems in NP. That is, no other problem in NP is harder than NP-Complete and if one NP-Complete problem is solveable in Polynomial time than all of NP is solveable in polynomail time, P=NP and you will win doctorates and a nobel prize, turing award and a million bucks from the clay institute for proving this. Sigh - you are probally still confused.. :)

    --
    If religous zealots don't believe in Evolution, then why are they so worried about bird flu?
  36. Re:Knuth by MrByte420 · · Score: 3, Informative

    a Proof is not rigorus if it depends on unproven theorems. There are many examples if theories that were thought to be true and were later proved to be false. This proof relies on nothing more than a little abastract algebra, some number theory and good ole plain algebra..

    --
    If religous zealots don't believe in Evolution, then why are they so worried about bird flu?
  37. 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)
  38. The question is by einhverfr · · Score: 3, Funny

    Whether polynomial time is longer or shorter than prime time.

    --

    LedgerSMB: Open source Accounting/ERP
  39. 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.

  40. Re:Nobel Prize Time by fatphil · · Score: 2

    ECPP is already polynomial time with theoretical exponent ~6. However, the
    best ECPP implementation out there, Marcel Martin's 'Primo', seems to behave
    as if it has exponent ~4.5-5.
    ECPP is non-deterministic though. But it looks like this one is too.

    So this looks as if it may be worse than the state of the art.

    I'll wait for Lenstra and Pomerance to say their piece though, before making
    my mind up.

    FatPhil

    --
    Also FatPhil on SoylentNews, id 863
  41. Re:Big consequences related to encryption by Bill+Currie · · Score: 2

    I think there's an error in your algo. Shouldn't it be t^f (mod pq) and message^g (mod pq)?

    --

    Bill - aka taniwha
    --
    Leave others their otherness. -- Aratak

  42. Re:p=np? by Anonymous Coward · · Score: 2, Informative

    Indeed, primality has been known since the 80's to belong to the class RP (problems solvable in expected polynomial time by a randomised algorithm). It has never (in recent years) been suspected of being NP-complete. Most experts don't even think factoring is NP-complete.

    (All this assuming P!=NP, or else all these distinctions collapse.)

  43. Re:arg. I did it again by jnana · · Score: 2

    You have to escape < with <, because otherwise the parser wouldn't be able to tell when an element tag was beginning or you meant less than. > isn't required to be escaped for this reason, because it is clear whether it is closing a tag or not. You also have to escape the ampersand, because otherwise the parser would have to scan ahead to know if you were specifying an entity like   or you just meant & and whatever.

  44. Re:I always thought is was in P by tunah · · Score: 2

    No. Polynomial time, as was said, is polynomial in terms of the input. Input b bits and n is (worst case) on the order of 2^b so now sqrt(n) is about sqrt(2^b)=2^(b/2) which is far worse than polynomial in b.

    --
    Free Java games for your phone: Tontie, Sokoban
  45. Re:arg. I did it again by orz · · Score: 2, Offtopic

    But I set it to plain text! Shouldn't slashdot automatically replace my (less-than) symbol with &lt or whatever?

    Since slashdot doesn't seem to be doing that I feel like the mode shouldn't be called "Plain Old Text".

    Ah well. I'm just bitter because I screwed up twice in a row.

  46. Re:p=np? by welthqa · · Score: 2, Funny

    how long have you guys been waiting for a topic on prime numbers, it's like your entire lives have been building up to this point. hurray!

    --


    100% Pure Evil With The Look And Feel Of Wholesome Goodness
  47. bad in math? by RelliK · · Score: 2, Redundant

    log2(16) = 4
    log2(32) = 5
    log2(64) = 6
    log2(128) = 7
    log2(256) = 8

    by your assumption a*log2(16)^12 + b = 1 ms
    for simplicity, let's ignore the constant b.
    then:

    a*log2(16)^12 = a * 4^12 = 1 ms (by assumption)
    a*log2(32)^12 = a * 5^12 = 14.5 ms
    a*log2(64)^12 = a * 6^12 = 129.75 ms
    ...
    a*log2(256)^12 = a * 8^12 = 4096 ms

    --
    ___
    If you think big enough, you'll never have to do it.
    1. Re:bad in math? by kavau · · Score: 3, Insightful

      Hold your breath... the algorithm is log2(n)^12 where n represents the number to be tested, not the number of digits. If you denote the number of digits by m, that is, m = log2(n), you get a complexity of O(m^12). The algorithm is therefore polynomial in the number of digits, with a very large exponent of 12. This large exponent could easily hamper the practical use of the algorithm, as Adam correctly demonstrated. The upshot is: Adam is right, RelliK is wrong!

  48. Re:Knuth by matrix0040 · · Score: 2

    well ERH is a million dollar problem (literally) !! Claymath.org, so i wouldn't bet my money on a proof which relies on ERH.

  49. Size matters by deblau · · Score: 3, Informative

    Note that this algorithm takes O((log n)^12). For this to actually be faster than, say, factoring n directly, and assuming a multiplicative factor of 1 in the order statistic, n has to be at least 3*10^22, or roughly 75 bits long. This algorithm is probably very ineffective at factoring small integers.

    --
    This post expresses my opinion, not that of my employer. And yes, IAAL.
    1. Re:Size matters by fatphil · · Score: 2

      Firstly note that the 12 is a proven upper bound, and for the majority of
      real world numbers it will be much lower.

      Secondly, it's not a factoring algorithm, so your final comment is a bit odd.

      Phil

      --
      Also FatPhil on SoylentNews, id 863
  50. Re:Big consequences related to encryption by kreyg · · Score: 2

    15 - 20 years until they're broken...

    Hmm... you know, I've been thinking... if anyone actually saves some of those packets floating around on the 'net, it my be possible to decrypt ALL of them in that time frame. In other words, even if it's encrypted, be aware that it may not be secure for the remainder of your life, perhaps much, much less. I wonder if I'll have the same credit card numbers in 15 years. Alternatively, I wonder if anybody will think about this more than a year before it's possible.

    Another interesting case where it's faster to wait for the hardware than to start chugging away with what we've got right now.

    --
    sig fault
  51. Re:I always thought is was in P by khuber · · Score: 3, Informative
    Er, I would call a simple divide "considerable".

    Assuming you meant "wouldn't call", division is definitely "considerable". Remember we are talking about large numbers. Try doing long division on paper for 35184535666823 divided by 4194319 (answer is 8388617) and you can see there is some work involved, even with these small numbers.

    The paper method of long division is O(n^2) and it turns out it can be done more efficiently: As I understand it, you can do division in the steps required for multiplication. Therefore the number of operations required to divide two n digit numbers is bounded by the best multiplication which is O(n lg n lg lg n) (from Knuth Volume II).

    This is about 57 for 10 digits and about 182 for 20 digits. You can see that doubling the number of digits here more than triples the required number of operations to compute this result! Likewise 30 digits require about 6 times more operations. You can see that the "n times" grows faster than the number of digits. Thus, division gets slower and slower the more digits you have to divide.

    -Kevin

  52. Re:for the sake of our eyes [OT] by spongman · · Score: 2
    yeah, you would have thought that Adobe, the people tht brought us Postscript could write half-decent font rendering code, but no...

    On the MaxOSX it looks great (I'm guessing they use the Mac's native font rendering), but on my XP box it looks like something from the mid 80's compared to the cleartype that everything else is done with.

    don't get me started on the ActiveX control...

  53. Re:Nobel Prize Time by fatphil · · Score: 2

    Where did you find out that they were reviewers?

    However, word on teh grapevine I have access to says that it seems
    that Henrik Lenstra (not to be confused with Arjen), has already
    declared taht he believes the proof to be correct and elegant.

    And that's about as high a recommendation as it gets.

    I'll try to knock up an implementation of his algorithm some time soon, and
    see what the practical big-Oh looks like.

    Phil

    --
    Also FatPhil on SoylentNews, id 863
  54. Re:Why does polynomial time matter? by fatphil · · Score: 2

    These principles ignore the fact that there's a finite amount of time,
    matter and energy in the universe.

    A P algorithm that can never be performed due to its order or constant
    factor has no practical use, only theoretical interest.

    Theoretical interest is still very interesting.
    Practical presses my bottons more though.

    Phil

    --
    Also FatPhil on SoylentNews, id 863
  55. 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
  56. It would be interesting... by GnomeKing · · Score: 2, Funny

    ...if he HAD found a way to do factoring in P time... gotta wonder what would happen if he took a holiday to the states - I'm sure SOMEONE would try to have a go at him for breaking encryption

  57. Re:Big consequences related to encryption by ranulf · · Score: 2
    but isn't a non-prime that passes the 99.99999999999% check just as good as a prime in encryption? I mean, seriously, is anyone really going to notice it's not prime?
    No, most messages will decode incorrectly.

    So, if the key obviously doesn't work, then you can assume that the modulus isn't prime and try another.

    In fact, following that argument through, you could have a test suite of various messages to encode. If they work, you can be reasonably sure the number is prime. Obviously, with this approach you'd need to be reasonably sure you had a prime, otherwise you'd waste a lot of time.

    Disclaimer: I dropped out of Uni level Maths before I got to anything particularly hard, so most of this is over my head.

  58. 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
  59. Discrete log also unaffected by yerricde · · Score: 2

    Only ... algorithms like RSA will be broken. Symmetric-key cryptosystems will be unaffected.

    As far as I know, public key crypto based on a discrete logarithm will be unaffected as well.

    --
    Will I retire or break 10K?
  60. Re:p=np? by Oztun · · Score: 2

    Yeah what the hell is this intelligent discussion. Lets go back to "Linux is uhh cool teehee". Or how about "Cowboyneal sure has a big hat, yup".

  61. Re:Mod parent down by volpe · · Score: 2

    I'm aware that calculating the integer square root function is part of the cost of the algorithm, but even so, it's still a polynomial time algorithm. And even if it weren't, you could make it polynomial by replacing "sqrt(n)" with "n". This would, of course, make the algorithm take *longer* on any practical implementation, but it would be just as correct and trivially polynomial.

  62. Proofs of X mod 9 and X mod 3 by UnknownSoldier · · Score: 2

    Indras> It's always easy to tell if a number is divisible by three, just add all the digits together, and if the result is divisible by three, then so is the original number.

    HaeMaker> Got a proof for this?

    You need to use these few Number Theory modulas rules:
    Eq 1. m mod m = 0 [defn. of modulas]
    and
    Eq 2. (a mod m) + (b mod m) = (a + b) mod m
    and
    Eq 3. (a*m) mod m = 0

    If you want a better handle on where Eq. 2 comes from, look at an analog clock.
    i.e.
    What is 11am + 9 hours expressed in am/pm format?
    = (11+9) mod 12
    = (12 + 8) mod 12
    = (12 mod 12) + (8 mod 12)
    = 8 pm

    Similiarly for Eq 3.

    The reason why (X mod 9) and (x mod 3) are interesting is because anytime you have 10 mod X = 1, you can use some mod tricks.
    0 mod 3 = 0
    1 mod 3 = 1
    2 mod 3 = 2
    3 mod 3 = 0
    4 mod 3 = 1
    5 mod 3 = 2
    6 mod 3 = 0
    7 mod 3 = 1
    8 mod 3 = 2
    9 mod 3 = 0
    10 mod 3 = 1

    INANT (I'm not a Number Theorist so please correct me if any of this is wrong! :) but here are a few exampes that should satisfy your curiousity.

    Now 909 mod 9 is:
    = (900 mod 9) + (9 mod 9)
    = (100*9 mod 9) + 0
    = 0

    Lets try 911 mod 9:
    = (100*9 mod 9) + (11 mod 9)
    = 0 + (9 mod 9) + (2 mod 9)
    = 0 + 0 + 2
    = 2

    and 974 mod 3
    = (300*3) + (74 mod 3)
    = 0 + (24*3 mod 3) + (2 mod 3)
    = 0 + 0 + 2
    = 2

    Cheers

  63. Please STOP! by phliar · · Score: 4, Insightful
    Everyone: just because you start out by writing "I'm no mathematician, but..." doesn't means you can pull crap right out of your ass. Words mean things, and when you talk about math, words mean things exactly. Please don't misuse them.

    It's the Sieve of Eratosthenes. A number n is of size log(n). This is a deterministic algorithm; why bring up NP? What is the time complexity of division? And here's a hint: you start with n-digit (n=100) numbers and present an algorithm that runs in time 10^n. This is in P?

    Has anyone actually read the paper? The algorithm is outlined, with a complexity analysis. Don't forget, P-time doesn't mean usable.

    --
    Unlimited growth == Cancer.
  64. Not constant... by Tom7 · · Score: 2

    > Probabilistic primality testing can be done in constant time with bounded error.

    You don't really mean constant time. Just looking at the number is already linear time!

    Miller-Rabin is also polynomial time (admittedly, a much better polynomial than this).

  65. Re:Cryptography by God!+Awful · · Score: 2


    what is this "euler's formula" of which you speak? i thought miller-rabin was the most commonly used primality test.

    I had trouble finding a good reference for this. As I mentioned before, the Euler test is very fast, but it is vulnerable to pseudoprimes. After you find a candidate, you may want to double-check it with another algorithm, such as Miller-Rabin. Here's a crypto library that uses both.

    -a

  66. *Simpler* proof of X mod 9 and X mod 3 by UnknownSoldier · · Score: 2

    I know its bad netiquitte to reply to one's own post, but I can clarify the proof in a much simpler way:

    When given a decimal digit d (equal to 0 thru 9), what is: d * 10 mod 3 equal to ?

    Using our mod rules:
    = (d*9 + d) mod 3
    = (d*9) mod 3 + (d mod 3)
    = (d*3*3 mod 3) + (d mod 3)
    = 0 + (d mod 3)
    That is, any digit times 10 mod 3 is equal to that digit.

    Similiarly we can extend this to any power of 10.
    e.g. d * 100 mod 3
    = (d * 100) mod 3
    = (d*99 mod 3) + (d mod 3)
    = (d*33*3 mod 3) + (d mod 3)
    = 0 + (d mod 3)

    We can use the same proof for when finding d*10 mod 9.

    So, using our previous example:
    What is 974 mod 3 = ?
    = (900 + 70 + 4) mod 3
    = (900 mod 3) + (70 mod 3) + (4 mod 3)
    = (9 mod 3) + (7 mod 3) + (4 mod 3)
    = (9 + 7 + 4) mod 3
    = 20 mod 3
    = (2 mod 3) + (0 mod 3)
    = 2

  67. Practical crypto sizes... Faster Algorithm by billstewart · · Score: 2
    Thanks for a discussion discussing actual speeds! O(logn**12) is pretty slow, but the paper also says that if a widely held conjecture is true, the algorithm should usually run in time O(logn**6), which is much less bad. That says that doubling the key length increases the run time by only a factor of 64, not 4096. I don't know if your run time examples are realistic, but this could make it occasionally usable.
    The authors also conjecture that if certain things are true, the algorithm could be changed to an O(logn**3) algorithm, which would be quite practical, perhaps competitive with the probablistic tests.

    In practice, most public-key crypto algorithms formerly used 512-bit or 1024-bit keys, and are tending to do 2048 bits today. A few paranoids use longer keys just because they can, but 2048 is generally believed to be good enough. Existing factoring technology has cracked 512-bit keys, and I think the longest successful crack is about 640 bits. Dan Bernstein's factoring machine proposal has led some people to abandon trust in 1024-bit keys, though other people think that's premature.

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  68. Re:Prime Number DB! by dbretton · · Score: 2


    Take all of the prime numbers that have been computed to date, and you could fit it all on a floppy, with probably room to spare for a Word document.

  69. Re: Use Double Keys DUH! by tbo · · Score: 2

    Ah you know most people who use the pair key system of encryption never have to worry about whether primes are factorable or not..

    I'm working more on the physics side of quantum computing, not the computer side, so I don't know quite as much about crypto as I'd like. I can see how it might be possible to have perfect forward security (which is what you're talking about) in a real-time two-way communcation scenario, but not in a one-way asynchronous situation like PGPed emails.

    Can you elaborate? I couldn't find anything with a Google search.

  70. Re:Big consequences related to encryption by kreyg · · Score: 2

    A few years ago, they only updated the date. They changed the number on my most recent card because they added some digits, no idea if they're going to change it next time.

    The point was less about my CC specifically, and more about "which numbers have I sent across the 'net that I'd rather nobody know?" I'm sure there are a few, from vital things to personal information that is supposed to be confidential.

    --
    sig fault
  71. 101*3*3 by wiredog · · Score: 2

    nuff said

  72. Re: Use Double Keys DUH! by God!+Awful · · Score: 2

    You can have perfect forward secrecy for dynamic communications, but the standard perfect forward secrecy algorithm (Diffie-Hellman) can also be cracked by a quantum computer.

    -a