V
V
Vitaly Pukhov2015-03-17 08:57:12
Mathematics
Vitaly Pukhov, 2015-03-17 08:57:12

Is it possible to determine in a reasonable time (hours \ days) whether a given number, with more than 1000 digits, is prime?

The essence of the question is in the title, I know that there are many algorithms, but I wonder how long the procedure will take, say if there are 1 million. signs. The number is predetermined.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Martyanov, 2015-03-17
@vilgeforce

There are probabilistic tests, such as Rabin-Miller.

M
Mrrl, 2015-03-17
@Mrl

The speed of the probabilistic algorithm is approximately C*L^2*log(L), where L is the length of the number being checked, C is the number of tests (the probability of false positive will not exceed 4^(-C)). This is if you use ultra-fast multiplication algorithms. For a million signs, the time will be several trillion - and everything depends on the constant there. Will it be hours or days - it's hard to say.
If the number being tested is equal to the product of several known primes + 1, then the test can give a guaranteed result, but in this case C is equal to the number of numbers included in the product.

B
Boris Nagaev, 2015-04-01
@starius

There is Agrawal's deterministic polynomial algorithm... for testing whether a number is prime.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question