Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For the curious: the reason that this property with 24 holds is because 24 = 2^3 * 3. For any prime number p:

p^2 - 1 = (p+1)(p-1)

And p+1 and p-1 must both be multiples of 2 because p is odd. Furthermore, one of p+1 or p-1 is also a multiple of 4 (because they are both multiples of 2 and only 2 apart). So, we can see where the 2^3 factor comes from in the magic number 24. The remaining factor, 3, comes from the fact that p is prime and not a multiple of 3, so either p+1 or p-1 must be a multiple of 3 (otherwise p-1, p, and p+1 would be three consecutive numbers, none of which are divisible by 3, which is impossible).

As a result, for any prime p > 3, (p+1)(p-1) is divisible by 24, so p^2 - 1 is also divisible by 24.



Haha, I feel so stupid now! Number theory always seems to impart this feeling to me. So many remarkable looking "coincidences" that have perfectly logical reasoning to explain them, if you dig a little.


I don't feel it's any the less remarkable for being logical...


you've just taken a ton of magic out of this article!

It seems downright obvious that p^2 - 1 would have to be divisible by 24 for any prime other than 2 or 3, and in fact completely unremarkable, after you point out the factorization.

After factoring p^2 -1 into (p+1)(p-1) you could have given the rest of the proof as an exercise to the reader.


Factoring p^2-1 into (p+1)(p-1) when you're trying to prove something about the factors of p^2 - 1 isn't exactly magic either. The entire proof is a pretty easy exercise. The only hard step is "stop reading and think for a moment".


The wikipedia article on the monster group doesn't even mention the number 24.


For any prime number p: p^2 - 1 = (p+1)(p-1) That's true for every number, including for example 3.4, PI, and 3+5i


Which is itself is just special case of difference of squares property:

x^2 - y^2 = (x - y) * (x + y)

In this case y is 1 and y^2 is 1, so this gives us aforementioned:

x^2 - 1 = (x - 1) * (x + 1)

Here is wikipedia page with the proof: http://en.wikipedia.org/wiki/Difference_of_two_squares


Which is itself a special case of the rule for the difference of two nth powers...


That's why the next sentence begins with the word "and"


It's generally best when writing a mathematical proof to be crystal clear about what assumptions are needed and which aren't.

(Of course, the OP doesn't deserve this level of criticism--he was just writing a quick sketch up on the internet.)


As an exercise to the for the reader show that any pair of twin primes surrounds a multiple of 6.


Not quite true: the first twin primes, 3 and 5, surround 4, not divisible by 6. However, for any other twin primes, both will not have factors of 2 or 3, so the number between them must have a factor of 2 and a factor of 3 (the latter by the same logic as in the parent post: otherwise three numbers in a row would not have a factor of 3).


Arghh. True.


Any pair of consecutive odds both of which are not divisible by 3 surround a multiple of 3


5 and 7?


those surround 6.


brilliantly clear explanation


Yes - the magic is stripped away by very clear algebra.


I was just curious, why is 24 x 10000+1 = 107 x 2243 not prime? I was under the impression for any n, 24 x n + 1 is prime.


For prime generating sequence you would be much better with Mersenne: http://en.wikipedia.org/wiki/Mersenne_prime

AFAIK there is no sequence that lists all primes, because of the property of prime numbers themselves (not divisible by anything except 1 and themselves). This essentially means that you can't use multiplication to generate primes.

Moreover checking if number is prime is hard in itself, because you need to check for divisibility by all previous prime numbers up until square root of prime candidate you are trying to check. Thus you can think of prime numbers as recursive series.


Moreover checking if number is prime is hard in itself, because you need to check for divisibility by all previous prime numbers up until square root of prime candidate you are trying to check.

That is not true - since 2002 a deterministic polynomial time primality test is known [1]. And even before that primality test faster than trial division were known [2].

Besides that it is true that there is currently no known algorithm to easily enumerate all primes but it is not impossible that such an algorithm exists.

[1] http://en.wikipedia.org/wiki/AKS_primality_test

[2] http://en.wikipedia.org/wiki/Primality_test


If that was the case, generating prime numbers would be much easier than it is.


24x1 + 1 = 25, so we're off to a bad start.


But it gets better soon: 24x2 + 1 = 49 and that is prime, isn't it? :-)


You forget the square root: 5 is prime.


huh? great-grandparent said nothing about square roots




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: