13 ms·
Is this prime?
- gragas 11y agoI got 22 on my first try. The most helpful trick is to note that if the digits add up to a multiple of 3 it cannot be prime (because it is divisible be 3) with the exception of 3 itself.
- valine 11y agoI always get tripped up on multiples of 13. I wonder why that is.
- iopq 11y agoThere is no easy way to tell multiples of 13. 91 is particularly hard because it's a multiple of 7 and 13. Obviously 5 * 13 is too easy. There's a test for division by 3, so 9 * 13 is too easy. So basically you should only miss 91.
- miracle_code 11y ago143 and 169 come to mind as well. Got 65 as highest score btw, was always a good calculator.
- madcaptenor 11y agoI've heard 91 called the "smallest non-obvious composite". Assume that testing for divisiblity by 2, 3, 5, and 11 is easy - for 2 and 5 you just look at the last digit, for 3 you take the sum of the digits, and with two-digit numbers a number is divisible by 11 if and only if both its digits are the same. Also assume that you can recognize squares. Then 91 = 7*13 is the first number that you won't recognize as composite using these test.
- sdenton4 11y agoThe more general test for eleven is to check that the alternating sum of the digits is zero.
- Bahamut 11y agoThere is a rule for divisibility by 7 - take the last digit, double it, and subtract from the rest of the numbers. If that is divisible by 7, the original number is too. For example, 91 gives 9 - 2 * 1 = 7, so it is divisible by 7
- EpicDavi 11y agoNeat trick! Just used it to find out that this post id is divisible by 7.
- sebastos 11y agoWell, I feel better for going out on 91 now after only 5 numbers.
- noobie 11y agoFor me it's 17, 17*3= 51 which at a first quick glance looks like a prime, up until you add the digits and it's clear of course.
- jemfinch 11y agoUse the test for divisibility by 3: if the sum of the digits is divisible by 3, the number is divisible by 3. 5+1=6, so 51 is divisible by 3.
- noobie 11y agoOh yeah, that's what I meant by saying "up until you add the digits and it's clear of course.". It's just an instant observation I guess.
- borkabrak 11y agoThat's one where experience playing darts really helps. :-)
- notJim 11y agoWhere I'm from, 17 and 51 are two freeways that run kinda parallel to each other, so that was an easy one for me.
- rangibaby 11y agoAt school we did exercises to memorize from 1x1 up to 12x12, so even now I can remember all of them (and powers of two, of course :-))
- JosephRedfern 11y agoFirst go: I got 23 correct, one wrong. Fun game!
- spuz 11y agoAfter a few goes my best score is 2. Considering I just wrote a program yesterday to calculate primes this is pretty embarrassing.
- Anderkent 11y agoNice game. Reminds me of Infinite Certainty: http://www.spaceandgames.com/?p=27 http://www.spaceandgames.com/?p=27 (now, granted there's a catch: question like 'is 89 prime' is harder than 'is 5 prime'; so it makes sense to have very high confidence of the latter (99.99% sounds reasonable) while much lower of the former) p.s. Game over 117 = 32×13 You correctly sorted 20 numbers. Feel I did pretty well.
- ilyanep 11y agoI got to 31 before I got tripped up on the exact same number. It looks prime!
- dylandrop 11y agoTrick: add up digits, if they are divisible by 3 so is the number. In this case 117 yields 1+1+7 = 9, and sure enough so is 117. (117 / 3 == 39). https://en.wikipedia.org/wiki/Divisibility_rule#Divisibility_by_3_or_9 https://en.wikipedia.org/wiki/Divisibility_rule#Divisibility...
- ilyanep 11y agoYeah, I had been doing that with other numbers, but somehow didn't trigger for that one. Must have been the timing pressure.
- motdiem 11y agoFun game - it would be great to have an achievement if your score is a prime number too
- nosage 11y ago"1 is non-prime by definition." dammit!
- delecti 11y agoI froze when I saw 1, and ended up going the same way you did. That one feels cheap. :P
- mediumdeviation 11y agoIt's mainly due to the Fundamental Theorem of Arithmetic (aka unique prime factorization) - https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithme...
- btilly 11y agoHowever this was not settled surprisingly late. I have seen tables of prime counts produced in the 1950s and 1960s that specified whether they counted 1 as a prime, and some did count it.
- OJFord 11y agoStill the case for the natural numbers (with 0 instead of 1). Though perhaps more obvious why you would choose one or the other there. Going through school I'd be told 1 was/not prime differently by different teachers. Always seemed pretty arbitrary to me; like 'They' ought just to decide! What we seem to be hearing here is that They had, just another classic case of this information taking 50 years to filter down the education system.. (I wonder how many planets they teach there as being in our solar system?)
- nonbel 11y ago>(I wonder how many planets they teach there as being in our solar system?) Your comment got me to look up the number of objects considered planets over the years, this has ranged from 5-23. Data since 1543 is available here: https://dx.doi.org/10.1038%2Fscientificamerican0107-34 https://dx.doi.org/10.1038%2Fscientificamerican0107-34 For fun I did a linear regression of year vs # planets and found that the while the slope was 1.8 planets/century, this was not significantly different from zero. The evidence appears to be consistent with a constant number of planets.
- billhendricksjr 11y agoGot 15 right. Also get caught up on multiples of 13
- ycmbntrthrwaway 11y agoCheatsheet: https://en.wikipedia.org/wiki/Divisibility_rule https://en.wikipedia.org/wiki/Divisibility_rule
- noobie 11y agoI guess programming ruined this sort of games for me.
- boterock 11y agoI think programming converts the game into a different kind of game.
- grimmdude 11y agoNice game. 530 correct, first try
- GavinMcG 11y agoI'm not sure which of us is sillier – you, for lying about this, or me, for spending my time calling you out. Or, hopefully, it was just a typo of 53. In which case I'd be impressed, since I haven't topped 25.
- grimmdude 11y agoDang, HN is so harsh. Yea just a joke; I couldn't get past 5. Fun game though.
- bnegreve 11y agoThere is a 60 sec timeout.
- bradlenox 11y agoSimple but effective - I like that it provides an explanation when you get one wrong.
- tlrobinson 11y agoIt had to be done: setInterval(function() { var n = parseInt(document.querySelector("#n").textContent); document.querySelector(is_prime(n) === "prime" ? "#yes" : "#no").click(); }, 0); document.querySelector("#start").click(); EDIT: replaced my isPrime with the one already in the game. EDIT 2: There appears to be some sort of increasing delay (pretty sure it's not just `is_prime` being slow) starting around 500 points. Maybe the game itself trying to compute primes?
- WA 11y agoAh, you beat me to the minute (game comes with a function is_prime): var yes = document.getElementById('yes'), no = document.getElementById('no'), n = document.getElementById('n'), start = document.getElementById('start'); function tick() { console.log('tick'); if (is_prime(n.innerHTML) === 'prime') { yes.click(); } else { no.click(); } window.setTimeout(tick, 500); } start.click(); tick();
- mfoy_ 11y agoOr, do away with the whole "checking" nonsense: game.check = function (answer) { this.streak += 1; this.next_n(); } setInterval(function() { document.querySelector("#yes").click(); }, 0); document.querySelector("#start").click(); (High score of 15,000!)
- malka 11y agothis. IF you cheat, you might as well take the easiest path of all :D
- rMBP 11y ago"Inspect Element"
- gfmio 11y ago24607 (with the cheat), 621 (without) :D Fun evening challenge :P function isPrime(n){ if ((n<=1) || (!n % 2)) { return false; } for (var k = 3; k < Math.round(Math.sqrt(n) + 0.5); k = k+2) { if (n % k == 0) { return false; } } return true; } var nSpan = $("span#n") var yesButton = $("button#yes"); var noButton = $("button#no"); var body = $("body"); function solve(){ if (isPrime(parseInt(nSpan.innerHTML)) { yesButton.click(); } else { noButton.click(); } if (body.className != "end") { setTimeout(solve,0); } } solve();
- timinman 11y agoNice game. Something weird can happen in the brain when we have to choose a binary answer under pressure. Maybe the fact that we are answering positively for prime (which is not the default) adds to that. For me it helped to rename 'yes' to 'prime' and 'no' to 'divisible'.
- cyborgx7 11y agoSame here. What happened to me is, instead of asking myself "Is this a prime number?" I kept starting to ask myself "Can this number be expressed as a multiplication of two other numbers?" for which the answers are obviously reversed.
- davidamarquis 11y agoFinding divisors is often hard when your number is large. It turns out the condition that a number n can be expressed as a multiple of two other numbers is equivalent to there being a number z less than n except for 1 and n-1 so that (z^2 mod n) == 1. This condition is the basis of the Miller-Rabin primality test. Sadly its a bit hard for humans to implement this algorithm for mentally proving primality.
- mmahemoff 11y agoYes, I found the UX aspect here interesting as it twisted my brain a bit too. A current example of this is the Brexit referendum, where the question was initially posed as a Yes or No, but required revision to a "Remain" or "Leave", which is much easier for casual observers to grok and lets people get behind their favourite actual position instead of embracing an arbitrary Boolean value (as happened with the Scottish referendum's Yes and No camps). Also, Prime itself is a tricky term for a Yes-No question as it's really a negative concept - the absence of something. So asking if X is prime is requiring double-negative logic in the same way as an app setting like "Disable X feature [On / Off]".
- autokad 11y agoi memorized all the prime numbers up to 100 for the GRE
- raverbashing 11y agoGot 21 Funny fact, the number 100, in any base (>2 obviously) is not prime (updated) In base 10, the number can only be prime if it ends in 1, 3, 7, 9 (where 10-1 = 9 and 10 - 3 = 7) - condition necessary but not sufficient of course If all digits sum to a multiple of 3 it is divisible by 3, of course (because 10^X mod 3 is 1 for any integer X) For 7 you want 3x the 2nd digit (21 - 2x3 + 1 = 7, divisible by 7) and 2x the 3rd digit (so 119 - 2x1 + 3x1 + 9 = 14)
- waqf 11y agoAu contraire, there are infinitely many bases in which "10" is prime. However, "100" is an example of a digit string which is not prime in any base. Another is "1001" (it's always divisible by "11").
- jaybosamiya 11y agoMore specifically "10" is a prime in all prime bases.
- raverbashing 11y agoOh you're right, I'm felling stupid now
- drdeca 11y ago100 in base 2 is composite.
- shkkmo 11y agoLarger Lemma: every number ending in '0' (besides '10') is not prime in any base. (The primeness of '10' obviously depends on the primeness of the base.)
- mistercow 11y agoInteresting how after a few games, I just became terrible at this. I started out getting 13-16 right before screwing up, but after a while, I was messing up after two on numbers like 21 and 63. I think this game broke me.
- momavujisic 11y agoAm I the only one who thought this was an online tool to check if a product was Prime-eligable on Amazon?
- consumer12321 11y agoYes.
- Diamons 11y agoI thought the same thing lol
- zodPod 11y agoThat's a pretty good idea! lol
- Namrog84 11y agoNope. I thought same thing.
- Kenji 11y agoI've been asking myself lately: What is the first prime number after googolplex? If you have an advice or know the answer, please do tell :) (This question appears to be very hard and it seems like nobody has the answer yet)
- Chinjut 11y agoWell, it is what it is (the first prime number after a googolplex). What would you prefer as a description of it? A listing of its digits? That would take rather a long time to read out. I can start you off, though. Its first few digits are 100000.... (It's easy enough to write a program that will eventually, slowly, find and stream to the display its digits or any other basic information about it you are interested in, of course. It's just infeasibly slow to use such a thing at the moment.) The current largest "known" prime, for some sense of what it is to indicate a specific number and know it to be prime, has about 20 million digits (and a very specific convenient form). The prime you are looking for will have about a googol digits instead. So, we're far off, at the moment, from being able to figure out the sort of information about it you're presumably interested in.
- Kenji 11y agoWell, we could represent it by googolplex + x. I believe x cannot be 1 for it to be prime due to number theoretical reasonings that I forgot in the meantime. So, we're far off, at the moment, from being able to figure out the sort of information about it you're presumably interested in. I'm not "presumably interested". I'm genuinely interested and curious about it. I'm just hesitant to invest a lot of time in it because of the unlikelihood of success.
- pvg 11y agoImagine primality testing was O(p) where p is the number of bits in the number you want to test. It is, in fact, way slower but let's give ourselves a huge advantage. Testing any googolplex-sized number would still be impossible. This seems to answer your question fairly simply and conclusively.
- rdl 11y agoI'd strongly prefer a UX of "Prime" "Composite" buttons, not "yes" "no". And exclude 1; it's special (not-prime for good reasons, but also not composite; Prime vs. Non-Prime isn't as good a test. Plus, treatment of one is largely for definitional reasons and isn't intuitive to non-mathematicians. Fun game, though!
- vlasev 11y agoYou'd have to exclude 1 if you were to do "prime" vs "composite" since 1 is neither of those.
- eva1984 11y ago29 right...yep
- binarymax 11y agoIf we're playing Stargate Atlantis rules then these numbers should be 3, 4, or 5 digits long.
- bigblind 11y agoMy top score so far is 35.
- Houshalter 11y agoThis is extremely relevant: http://www.spaceandgames.com/?p=27 http://www.spaceandgames.com/?p=27
- hellbanner 11y agoSave you all some time: http://primecoin.io/ http://primecoin.io/
- eachro 11y agoGot 41. The ones over 100 took me quite a bit longer than the sub 100 numbers.
- mbrumlow 11y agoI did mine the hard way. No java script here. https://www.youtube.com/watch?v=3ITOhyVemCU https://www.youtube.com/watch?v=3ITOhyVemCU
- thomasahle 11y agoThere is a nice rule I heard once: "Below 100 (119 really), any number that looks like a prime is a prime. Except 49 and 91". The remaining composite numbers are all trivially divisible by 2 or 5, or their digit sum is divisible by 3.
- shasta 11y agoor by 11.
- AReallyGoodName 11y agoThe not 49 and 91 rule combined with the rule that "a prime above 3 is always exactly 1 off being a multiple of 6" will get you flying through this test.
- transitorykris 11y agoOr the Grothendieck prime, 57 https://en.wikipedia.org/wiki/57_(number) https://en.wikipedia.org/wiki/57_(number)
- cplease 11y agoHoly shit Grothendieck died in 2014, I NEVER MOURNED HIM. How did this happen?
- sanderjd 11y agoI don't think 49 "looks like a prime", because it's clearly 7^2. But I hadn't realized that the other perfect squares are obvious non-primes for other reasons, ie. because of 2s, 3s, and 5s. Neat!
- kazinator 11y agoGame needs a control panel where you can customize it. I'd like to be able to declare that 51 is prime for the purposes of play.
- ninju 11y agoYou can check if a number is prime by going to the URL http://isthisprime.com/nnnnn.. http://isthisprime.com/nnnnn... where nnnn is a number (like http://isthisprime.com/5867868 http://isthisprime.com/5867868) (note it does take some time with BIG numbers)
- p01926 11y agoThere's a similar game on iOS — Infinite Primes. https://itunes.apple.com/us/app/infinite-primes/id1063881848?mt=8 https://itunes.apple.com/us/app/infinite-primes/id1063881848...
- richardkiss 11y agoThe following theorem, originally imparted to me by an algebra professor in the UCLA math department (grad school), may be helpful to you when testing yourself: Theorem. All numbers < 100 that look prime, are prime EXCEPT 91. (My addendum) Where "look prime" means, is not a multiple of 2, 3, 5, 11, nor a perfect square. All these numbers have quick tests for divisibility. Note that 91 = 7 * 13.
- sanderjd 11y agoThat's awesome. Came here to say that 91 keeps killing my gut-instincts!
- nevi-me 11y agoAny number whose digits sum up to a multiple of 3 (3,6,9) when summed until 1 digit remains; is a multiple of 3. Could this be something useful as a quick check for qualifying numbers? I don't have any Assembly knowledge, but I presume that it wouldn't be efficient implementing this, because of having to cast to string, then back from string for each digit. Then the while loop to sum each digit. Running the check only for odd numbers could also be an improvement.
- danbolt 11y agoI'd love to see the statistics on which numbers get guessed right/wrong.
- photonios 11y agoWorks on pretty much any browser: var element=document.getElementById("n");element.addEventListener("DOMSubtreeModified",function(){function a(a){setTimeout(function(){var b=document.createEvent("Events");b.initEvent("click",!0,!1),document.getElementById(a).dispatchEvent(b)},1)}var b=parseInt(element.innerText);a("prime"===is_prime(b)?"yes":"no")});