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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Primg – Generate prime numbers whose binary representation looks like any image

110 点作者 geonnave超过 7 年前

16 条评论

shabda超过 7 年前
Here is my Python implementation: <a href="https:&#x2F;&#x2F;github.com&#x2F;shabda&#x2F;experiments&#x2F;tree&#x2F;master&#x2F;prime_dinos" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;shabda&#x2F;experiments&#x2F;tree&#x2F;master&#x2F;prime_dino...</a><p>I put up a show HN, but no one liked it :) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16198861" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16198861</a>
评论 #16263070 未加载
评论 #16263471 未加载
knodi123超过 7 年前
The example on <a href="https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg</a> shows a binary number ending with zero; doesn&#x27;t that mean it&#x27;s even, and therefore divisible by 2?
评论 #16261923 未加载
评论 #16261911 未加载
评论 #16261901 未加载
notahacker超过 7 年前
Not convinced I actually look like<p><pre><code> 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357110553379400815780032957688591226535854678434413850350192892043530395436831148532011789232552521569332295554081981793617293526812832242447096911185919439189235252915185597964786711096720343</code></pre> tbh ;-)
评论 #16261954 未加载
评论 #16261377 未加载
Retr0spectrum超过 7 年前
You could probably speed things up a lot using isProbablePrime(), at least to pre-filter candidate numbers. (Assuming you&#x27;re using this library: <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;big-integer#isprobableprimeiterations" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;big-integer#isprobableprimeite...</a>)
评论 #16262371 未加载
krishna2超过 7 年前
You could color the 1s and 0s - so the image is more obvious and enhanced.
mbrd超过 7 年前
Relevant Numberphile on generating prime pictures: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=fQQ8IiTWHhg" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=fQQ8IiTWHhg</a>
oh_sigh超过 7 年前
Perhaps it shouldn&#x27;t even bother generating a binary number that ends in &#x27;0&#x27;
jchavannes超过 7 年前
Is there a way to link to a number? Or enter a number to view the image?
评论 #16261957 未加载
OskarS超过 7 年前
These are very neat, but all of these I&#x27;ve seen the last few weeks use the same trick of putting some garbage at the end to make it a prime. I wish people would vary their techniques a bit: like, make it base 10 and make an ascii-art image, and introduce imperceptible noise to make it a prime. Or, vary the number of rows and columns, and maybe scale of the image, to make it prime.<p>We need to disrupt the &quot;images as primes&quot; industry!
评论 #16265609 未加载
评论 #16264629 未加载
ars超过 7 年前
Can you use this for encryption? Make the decryption key the prime number generated by this, and you unlock it by pointing the camera at the right thing?
评论 #16261494 未加载
评论 #16261502 未加载
评论 #16266783 未加载
ot超过 7 年前
&gt; numberBigInt = numberBigInt.minus(1)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg&#x2F;blob&#x2F;master&#x2F;index.html#L82" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg&#x2F;blob&#x2F;master&#x2F;index.html#L82</a><p>Could go double as fast subtracting 2 instead of 1 (why try the even numbers).
评论 #16265062 未加载
JorgeGT超过 7 年前
Is this in response to <a href="https:&#x2F;&#x2F;mathwithbaddrawings.files.wordpress.com&#x2F;2017&#x2F;10&#x2F;2017-10-6-odd-number-theorists.jpg" rel="nofollow">https:&#x2F;&#x2F;mathwithbaddrawings.files.wordpress.com&#x2F;2017&#x2F;10&#x2F;2017...</a> ?
评论 #16261808 未加载
com2kid超过 7 年前
This takes a very, very, very long time.<p>20 minutes in, it is up to 13388 in Firefox.<p>Funny enough, I ran the same image through Chrome, it said it was finish at iteration 458. I&#x27;m guessing it is not completely deterministic?
评论 #16262310 未加载
jwilk超过 7 年前
Source: <a href="https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;geonnave&#x2F;primg</a>
seertaak超过 7 年前
Ah, but can you generate a prime number that encompasses the full list of true statements, please? :)
memyselfando超过 7 年前
Would it not be preferrable to change as little bits as possible? Instead of counting up from your number you should first try to change single bits (one bit, two, three ...)<p>Changing a single out of 32<i>32 bits gives you 1024 variations. Changing two already gives you 1024</i>1023&#x2F;2 = 523776 variations.