[POSTER]: Hi, I’m working on RSA key generation. As you know, I need two distinct prime integers (p and q) to kick things off. Is there a quick way of testing primality when attempting to generate these numbers randomly, on-the-fly other than time-consuming, brute force mathematics? I need to create a test application for it as quickly as possible.
[BLOGGER1]: Have you thought about starting with Euler’s totient function then moving backwards?
[BLOGGER2]: Did he say “toilet” function?
[BLOGGER3]: I don’t think that’s possible since Euler’s phi function still requires n=pq.
[BLOGGER2]: I don’t give a “phi” about what Euler’s thinks.
[POSTER]: I know that n must be coprime, but integer factorization and primality testing has never been a strong subject for me.
[BLOGGER2]: It’s Obama’s fault!
[BLOGGER4]: Hi. You may want to try using a regular expression instead. I found this tasty Python morsel online:
import re def is_prime(num): return not re.match(r"^1?$|^(11+?)\1+$", "1" * num)
[BLOGGER2]: Hey, check this out, I found this online too:
[POSTER]: Thank you for everyone’s help. I found want I was looking for. до свидания!