On Tue, 05 Jun 2012 12:05:59 +0100, Timothy Murphy <firstname.lastname@example.org> wrote:
> Peter Percival wrote: > >> Let p_n be the n-th prime number (p_1 = 2, etc). Is there a polynomial >> P(n), and an algorithm to find p_n in a number of steps* S(n), where >> S(n) >> is bounded by P(n)? >> >> * A step being what? If I were to write a program to implement such an >> algorithm, I would take "step" to mean "machine code instruction"; but >> there might be a better definition not tied to any particular way of >> implementing algorithms. > > I'm not an expert in this area, > but I think with your definition of polynomial time > your problem would be trivially easy. > > Usually polynomial time would mean P(log n) not P(n),
Silly me, I didn't know that!
> since it would be measured in terms of the length of n (as a binary > digit) > not in terms of n itself. > > The AKS algorithm shows that one can determine in time P(log n) > if n is prime or not.
Luckily, Wikipedia knows what the AKS algorithm is!
> We know p_n is roughly n log(n), say p_n < n^2 for n > N. > So one could go through all the numbers 1,2,3,...,n^2, > determining if each was prime in time < P(2 log n), > and this would take time < n^2 P(2 log n). > > I don't know if one could find p_n in polynomial time > using the usual definition of this.