Cryptography, Python, Math, Mathematics, Diffie Hellman.
iterate over all possible values of r and check if b^(2^r)≡-1(mod n) by utilizing the Python pow(base, exponent, modulus) function. Note that if this is the case, then b^(2^r) = n-1. So, if b^(2^r)≡-1(mod n) for any r, then n is pseudoprime and we return True to indicate this finding. Otherwise, we