Ack... I'm an idiot: Skip> def safe_primes(last=1): Skip> last = long((last-1)/2) # assuming future float division... should be last = (last-1)//2 # doh! Skip> while True: Skip> last = gmpy.next_prime(last) Skip> other = last * 2 + 1 Skip> if gmpy.is_prime(other): Skip> yield other Skip