Fastest primality test

前端 未结 3 582
渐次进展
渐次进展 2020-11-28 14:45

Could you suggest a fast, deterministic method that is usable in practice, for testing if a large number is prime or not?

Also, I would like to know how to use no

3条回答
  •  萌比男神i
    2020-11-28 15:23

    "Probably" actually means 1-ε, and ε gets as small as you need.

    Most applications have some small yet nonzero probability of failing that is not connected to primality testing, for example

    • in cryptographic applications, an attacker luckily guessing the secret with, for example, a probability of 2^(-100)

    • a hardware failure (radiation-induced) randomly flipping some bit of your computer memory (maybe one that holds the output of your "deterministic" primality test

    • bugs (indeed, more probable than the other type of failures)

    So pressing the ε to that order of magnitude will suffice in practice.

    For example, OpenSSL, GnuPG of use non-deterministic primality test only. ``Probably'' you don't really want no deterministic test. But check what is available to you: If you have any libraries at hand, and they perform enough - go on and use them.

提交回复
热议问题