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

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: