TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Super fast continuous prime sieve

4 点作者 ghostforceone大约 2 年前

1 comment

eesmith大约 2 年前
It uses SageMath. Replace &quot;.nbits()&quot; with &quot;.bit_length()&quot; for normal Python (documentation says nbits is an alias: <a href="https:&#x2F;&#x2F;doc.sagemath.org&#x2F;html&#x2F;en&#x2F;reference&#x2F;rings_standard&#x2F;sage&#x2F;rings&#x2F;integer.html#sage.rings.integer.Integer.nbits" rel="nofollow">https:&#x2F;&#x2F;doc.sagemath.org&#x2F;html&#x2F;en&#x2F;reference&#x2F;rings_standard&#x2F;sa...</a> ).<p>You&#x27;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?
评论 #35054215 未加载