mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
982c42cb20
Generates a number coprime to 2, 3, 5, 7, 11. Speed: Trial div (add) : trial div (retry) : coprime 1 : 0.42 : 0.84
22 lines
444 B
Python
22 lines
444 B
Python
primes = [2, 3, 5, 7, 11]
|
|
safe = False # Not sure if the period's right on safe primes.
|
|
|
|
muliplier = 1 if not safe else 2
|
|
for p in primes:
|
|
muliplier *= p
|
|
|
|
offsets = []
|
|
for x in range(3, muliplier + 3, 2):
|
|
prime = True
|
|
for p in primes:
|
|
if not x % p or (safe and not ((x - 1) / 2) % p):
|
|
prime = False
|
|
break
|
|
|
|
if prime:
|
|
offsets.append(x)
|
|
|
|
print(offsets)
|
|
print(len(offsets))
|
|
print(muliplier)
|