It uses SageMath. Replace ".nbits()" with ".bit_length()" for normal Python (documentation says nbits is an alias: <a href="https://doc.sagemath.org/html/en/reference/rings_standard/sage/rings/integer.html#sage.rings.integer.Integer.nbits" rel="nofollow">https://doc.sagemath.org/html/en/reference/rings_standard/sa...</a> ).<p>You'll also need to remove the IPython import if not using a notebook.<p>Curiously, the listed output includes:<p><pre><code> First 5 primes found and last five primes found [2, 3, 11, 13, 17]
... [4194295, 4194299, 4194301, 4194305, 4194307]
</code></pre>
5 and 7 are not on that list. And 4194295 = 5 * 7 * 293 * 409 is not prime, and 4194299 = 29 * 61 * 2371 is also not prime. And 4194305 is clearly not prime either.<p>How is this supposed to be a prime sieve?