Live data from Hacker News

Is This Prime?

isthisprime.com

121–130 of 139 posts

Re: Is This Prime?

#123

This reminds me of my favorite in-person magic trick to do. First, memorize all the two-digit primes. 25 numbers isn't that hard to memorize. Then, tell someone "Oh, I can instantly tell whether a number is prime or not. Give me a number, I'll tell you whether it's prime." If they tell you a number between 1 and 100, use your memorized list. Otherwise, it's a game of cold reading; if they just generated a random stri…

Somehow I've memorised 10243 in order to have a "big prime" that most people can't just determine. Note its the lowest 5 digits.

I'm always using 1000003 and 1000000009 if I need a big prime in code. Million 3, billion 9 - very easy to remember

Re: Is This Prime?

#124

Here is a "theorem" I learned: every number up to 100 which looks prime, is prime, except 91. Does anyone recall its name?

Don’t know the name of the “theorem”, but I know the rhyme: 91 is not a prime that one trips me every time.

But that doesn’t really help you remember 91, because the number is not part of the rhyme.

Re: Is This Prime?

#125
post #98

If I click start, then paste some quick and dirty browser automation in the console: function c(){is_prime(document.getElementById('n').textContent)==="prime"?yes.click():no.click();window.setTimeout(c,1)};c() 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 "Out of range value for column 'end' at row 1" :)

That made me wonder how the game determines if the number is a prime or not. Turns out it's the Miller-Rabin test with a deterministic variant used for the range (up to 2^53) the game supports. I don't know why the game internally uses a bigint implementation while only supporting numbers up to 2^53 though...

Re: Is This Prime?

#126
post #40
post #37

Earlier quoted context omitted.

I agree. And I would add 51 to that.

51's an easy one because 5+1=6, and 6 is divisible by 3, so it must be divisible by 3. It's easy to try 'divisible by 5' (ends in 5 or 0) and 'divisible by 3' (sum of digits is divisible by 3). 91 isn't found as prime by those two tests, so it needs the extra exceptional rule.

Of course! I actually know of this divisible by 3 rule, and use it to test out all numbers, like 87, 111, or 69, but somehow forget to apply it to 51…

Re: Is This Prime?

#127
post #82

Earlier quoted context omitted.

Based on my failure at this game, anything times 19 looks prime to me.

Well you only have 4 of those under 100. The "looks prime" rule assumes you check for multiples of 3, so that removes one. All the rest end in an even digit or 5.

yeah once i started doing the trick for 3's the whole thing got boringly easy

Re: Is This Prime?

#129
post #77
post #74

Earlier quoted context omitted.

That breaks the uniqueness of the prime factorization. Mathematicians love uniqueness, almost as much as existence.

Could you please demonstrate an example of such a break? I think if we really look at it, we might see that it's really just convention and semantics. I don't want to seem like I'm cherry picking by providing my own example.

The unique prime factorization of 15 is 3⋅5.

Let's call a number an Igelau prime if it is the number 1 or a prime number. Then an Igelau prime factorization of 15 is 3⋅5. Another Igelau prime factorization of 15 is 1⋅3⋅5. Another Igelau prime factorization of 15 is 1²⋅3⋅5. And so on. There are infinitely many Igelau prime factorizations of 15, thus there is no uniqueness.

Edit: Clarifying what Igelau primes are.

Re: Is This Prime?

#130
post #25

Earlier quoted context omitted.

One is not a prime number. If you allow one to be a prime number, then you can no longer say that each natural number has a unique prime factorization. This makes the concept of prime numbers much more useful when one is excluded.

and there will be no prime numbers above 1 if 1 is considered a prime (based on existing definitions) Though if you think about it they can just modify the definition in that case

The definition I usually use (speaking loosely for the moment) is that prime numbers are natural numbers greater than one whose divisors are only one and itself.

Speaking more formally, a natural number p is a prime if and only if:

a) p > 1

b) for any natural number n satisfying 1 < n < p, p mod n ≠ 0

Post reply on HN