pyprimesieve
pyprimesieve copied to clipboard
Process finished with exit code -1073741819 (0xC0000005)
When generating primes up to 1e12, the process exits with an unusual error code. I imagine it's due to my system not having enough memory, but I thought primesieve might be able to deal with this situation.
pyprimesieve.primes(5245028923, int(1e12))
pyprimesieve immediately sends this code, which I can't really make sense of after a cursory glance at the source of this library and primesieve. It would be nice to know what's going on, but I fear I'll have to use primesieve itself to debug the error as it is now.
Similar error with the following snippet:
pyprimesieve.primes(4, 5)
It checks numbers between start to end-1, so in this case only 4. As 4 is composite, there aren't any primes there.
Instead, it returns an' array of [<NULL>, <NULL>].
Currently detecting via the following; though it's not good code.
primes = pyprimesieve.primes(4, 5)
if "<NULL>" in str(primes):
print("No Primes.")
else:
print("Are Primes.")
In your case, however, it's likely you're running out of RAM. Primes from 5_245_028_923 to 20_000_000_000 take ~25.4 GB of RAM. I'm not familiar regarding the RAM utilization trend, but very optimistically assuming linear (probably very inaccurate), 1e^12 would need ~1,712 GB. And that's optimistic.