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.
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".
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).
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.
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.