I have a Python code to generate random prime numbers in a specified interval:
import gmpy2
import random
def getprimeover(n):
"""return a random n-bit prime number
"""
r = gmpy2.mpz(random.SystemRandom().getrandbits(n))
r = gmpy2.bit_set(r, n - 1)
return int(gmpy2.next_prime(r))
while True:
ran = getprimeover(32)
print(ran)
I'm trying to change this in order to get a sequence instead and/or to get only values from a hexagonal subrange, let's say from
80000001 to f0000000
Do you have some clues on doing this?
Aucun commentaire:
Enregistrer un commentaire