TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Is This Prime?

196 pointsby jordighalmost 4 years ago

33 comments

lalaithionalmost 4 years ago
This reminds me of my favorite in-person magic trick to do.<p>First, memorize all the two-digit primes. 25 numbers isn&#x27;t that hard to memorize.<p>Then, tell someone &quot;Oh, I can instantly tell whether a number is prime or not. Give me a number, I&#x27;ll tell you whether it&#x27;s prime.&quot;<p>If they tell you a number between 1 and 100, use your memorized list. Otherwise, it&#x27;s a game of cold reading; if they just generated a random string of many digits, there&#x27;s a low chance that the number actually is prime. &quot;21923847&quot; is a keysmash, and it&#x27;s almost certainly not prime, because the frequency of primes goes down as numbers get bigger. And most people will ask you a number, hear &quot;no&quot;, and then go check the number&#x27;s primality. Eventually, they&#x27;ll look up a number in advance; that number is almost certainly prime.
评论 #27850486 未加载
评论 #27851312 未加载
评论 #27853547 未加载
评论 #27850816 未加载
评论 #27855975 未加载
评论 #27853474 未加载
评论 #27850848 未加载
davjhanalmost 4 years ago
I love these simple web games! Great idea. One way to improve it is to add some more juice when you answer a question. Right now, the text in the number just swaps to the next question, so any sort of small visual feedback will help first time players get it more.<p>I also like to make these small web mini games on the side. Here&#x27;s one where you guess the year that famous events happened: <a href="https:&#x2F;&#x2F;guess-the-year.davjhan.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;guess-the-year.davjhan.com&#x2F;</a>
tyingqalmost 4 years ago
If I click start, then paste some quick and dirty browser automation in the console:<p><pre><code> function c(){is_prime(document.getElementById(&#x27;n&#x27;).textContent)===&quot;prime&quot;?yes.click():no.click();window.setTimeout(c,1)};c() </code></pre> My old laptop can guess right 16k times and get up to 4172973243025599, but then the http post to do the stats (record.php) bombs with a MySql error <i>&quot;Out of range value for column &#x27;end&#x27; at row 1&quot;</i> :)
评论 #27853242 未加载
评论 #27854632 未加载
ridiculous_fishalmost 4 years ago
Here is a &quot;theorem&quot; I learned: every number up to 100 which looks prime, is prime, except 91. Does anyone recall its name?
评论 #27850520 未加载
评论 #27851897 未加载
评论 #27851501 未加载
评论 #27851026 未加载
评论 #27850420 未加载
评论 #27850708 未加载
评论 #27850644 未加载
评论 #27852613 未加载
评论 #27850777 未加载
评论 #27854322 未加载
HeavenFoxalmost 4 years ago
When I was a fifth grader in China, we were required to memorize all prime numbers below 100.<p>Curious if that is common in other countries?
评论 #27850982 未加载
评论 #27850759 未加载
评论 #27851544 未加载
评论 #27850796 未加载
评论 #27850375 未加载
__michaelgalmost 4 years ago
Finally a way to sort out candidates that&#x27;s even cheaper than making them implement B-trees.
josephcsiblealmost 4 years ago
After lots of 2-digit numbers ending in 5 came up, my brain went on autopilot thinking &quot;any number that ends in 5 is not a prime&quot;. I lost when 5 came up.
sebzim4500almost 4 years ago
I&#x27;m not sure why but having &#x27;yes&#x27; be on the left is really messing me up.
评论 #27850613 未加载
quercusaalmost 4 years ago
I&#x27;ve started, if I wake up in the middle of the night, thinking of a &#x27;prime-looking&#x27; number, then trying to factor it. Sometimes I discover interesting connections, other times I fall back asleep - either is a win.
exo-pla-netalmost 4 years ago
Good practice for learning divisibility rules <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Divisibility_rule" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Divisibility_rule</a>
andrejewskialmost 4 years ago
This is really cool! I made a very similar game a couple years ago: <a href="https:&#x2F;&#x2F;jew.ski&#x2F;prime-time&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jew.ski&#x2F;prime-time&#x2F;</a><p>It&#x27;s interesting to compare the game play and design. My game is written in Elm and open source if anyone is interested. This website has keyboard inputs (y or n) which is a good idea. My game only does click&#x2F;touch inputs.
whoomp12342almost 4 years ago
man, these tech screenings are getting out of control
optimalsolveralmost 4 years ago
Is there a reason we&#x27;re obsessed with primes beyond aesthetics? Why does this set of numbers garner all the headlines as opposed to some other arbitrary integer sequence like the Recamán numbers [0] ?<p>If tomorrow someone discovered a closed-form equation for the nth prime, how would mathematics&#x2F;the world change?<p>[0] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Recamán%27s_sequence" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Recamán%27s_sequence</a>
评论 #27850250 未加载
评论 #27850228 未加载
评论 #27851188 未加载
评论 #27852019 未加载
评论 #27852469 未加载
评论 #27851850 未加载
评论 #27850221 未加载
TheDudeManalmost 4 years ago
Love it. But if you are clicking an answer just as time is running out, you won&#x27;t get to see your score (it starts a new game).
lexliebermanalmost 4 years ago
I&#x27;ve spent a good week of straight hours on primes by now, the most fun thing I&#x27;ve come up with was this boring sieve.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;alexlieberman&#x2F;Prime-Numbers&#x2F;blob&#x2F;master&#x2F;SixSieve.java" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alexlieberman&#x2F;Prime-Numbers&#x2F;blob&#x2F;master&#x2F;S...</a>
评论 #27852917 未加载
koolbaalmost 4 years ago
I was expecting an Amazon product search &#x2F; review site and was pleasantly surprised that it is in fact a math game.
powerbrokeralmost 4 years ago
I&#x27;m using this as a metric to determine if my brain is deteriorating. (my age) + (my best score, without more than a few minutes of &#x27;training&#x27;) &gt; 80 means I&#x27;m still doing OK.<p>Today, at 56 years wise, I scored 34, so 90 &gt; 80. Means I judge myself to be smart enough to put my shoes on the correct feet, still.
Imnimoalmost 4 years ago
My prime number skills only go up to 47 because that&#x27;s how high Number Munchers went.
评论 #27851631 未加载
W0lfalmost 4 years ago
I am not doing _that_ type of number crunching in my daily work, so the following check (in Python) has probably lots of potential for improvement:<p><pre><code> def is_prime(n): return not True in [n%x == 0 for x in range(2, n&#x2F;2)]</code></pre>
评论 #27856806 未加载
spoonjimalmost 4 years ago
I think this question is framed the wrong way for me. I think if the question was &quot;Is this composite?&quot; I would get much better scores. The way I think is &quot;Does it have a factor?&quot; and inverting that Boolean trips me up.
Klunyalmost 4 years ago
I love it, but the game doesn&#x27;t work for me! No response when I click Yes or No, or using the keyboard y and n. Just the clock ticking down. Chrome Version 91.0.4472.114 (Official Build) (64-bit) on Windows 10 Enterprise.
nonfamousalmost 4 years ago
I’ve always wondered: how feasible is it to implement an “isprime” function, via lookup table? If such methods are used, is cryptography getting weaker and weaker in practice as more large primes are discovered?
评论 #27851104 未加载
gerbleralmost 4 years ago
I really like it.<p>I wonder if the text could be dropped once it starts. I found myself reading it each time which ended up distracting me a little and sometimes I would rush and tapped the opposite of what I intended.
Igelaualmost 4 years ago
Why do I feel like I&#x27;m solving someone else&#x27;s CAPTCHA?
crackercrewsalmost 4 years ago
PSA: you can use the arrow keys to answer more quickly.
评论 #27852631 未加载
kstrauseralmost 4 years ago
78. Who did better?
评论 #27852348 未加载
评论 #27852924 未加载
jkingsberyalmost 4 years ago
Great game!<p>Keyboard short cuts would make it a bit better.
评论 #27850720 未加载
评论 #27850740 未加载
评论 #27851097 未加载
perryizgr8almost 4 years ago
&gt; 1 is non-prime by definition.<p>This made me sad :(
评论 #27853545 未加载
ramshankeralmost 4 years ago
Game over<p>1 is non-prime by definition.<p>You correctly sorted 17 numbers.
marcodiegoalmost 4 years ago
Cool! Now let&#x27;s try to find a way to make this fit in a fast paced space shooter.
评论 #27853469 未加载
slmjkdbtlalmost 4 years ago
Would pay to for more chances
ineedasernamealmost 4 years ago
-3
X6S1x6Okd1stalmost 4 years ago
They&#x27;ve included 1 as not a prime. That was a fairly recent decision.
评论 #27850513 未加载
评论 #27850258 未加载
评论 #27850265 未加载