Lucas-Carmichael numbers: Difference between revisions
m
→{{header|Python}}: use the built-in `pow(b,-1,m)` for computing the modular inverse (faster)
m (→{{header|Python}}: minor optimization) |
m (→{{header|Python}}: use the built-in `pow(b,-1,m)` for computing the modular inverse (faster)) |
||
Line 500:
Uses the [[wp:SymPy|SymPy]] library.
<syntaxhighlight lang="python">from sympy.ntheory import sieve, isprime, prime
from sympy.core import
from math import lcm, gcd, isqrt
Line 513:
hi = min(B // m + 1, max_p)
u = l -
while u < lo: u += l
if u > hi: return
|