Showing the nth prime is primitive recursive

In summary, the function $f(n)$ which returns the $n$th prime is a primitive recursive function. This is proven by defining $f(0) = 2$ as the base case and then using induction to show that $f(n)$ returns the $n$th prime for all $n$. This is achieved by using a primitive recursive bounded search to find the next prime number after $f(n)$ by searching in the interval $[ f(n) + 1, f(n)! + 1 ]$. This method may seem unconventional, but it is still valid as the predicate being searched for is primitive recursive.
  • #1
Nono713
Gold Member
MHB
618
4
I've been asked in an exercise to show that the function $f(n)$ which returns the $n$th prime is a primitive recursive function. We've covered the basics of primitive recursion, the primitive recursive schematic notation, addition, multiplication, limited subtraction, bounded products, sums, quantifiers, bounded search (minimization), and relations/cases. Could someone check over my work, because I'm still not comfortable with how to build these kinds of proofs:



Premises:

- the prime decision function ($p(x) = 0$ if $x$ is not prime, $p(x) = 1$ otherwise) is primitive recursive
- the factorial function and subtraction function are primitive recursive (proved earlier)

Proof:

We first define $f(0) = 2$ (the first prime is $2$) which is a composition of primitive recursive functions (using the successor and zero functions), and is the first prime number. So the base case holds.

Next we assume that $f(n)$ is the $n$th prime number, and we define $f(n + 1)$ as "the least $x$ less than or equal to $f(n)! - f(n)$ such that $x + f(n) + 1$ is prime". From Euclid's proof of the infinitude of primes, which shows there exists a prime between $m$ and $m! + 1$ for any natural number $m$, the above means that $f(n + 1)$ returns the smallest prime in $[ f(n) + 1, f(n)! + 1 ]$, which is the next prime after $f(n)$. Therefore, by induction, $f(n)$ does indeed return the $n$th prime for all $n$.

The expression for $f(n + 1)$ is a (primitive recursive) bounded search, as we search in the interval $[ 0, f(n)! - f(n) ]$ for the least element $x$ which satisfies the primitive recursive relation "$x + f(n) + 1$ is prime", where the interval bounds are finite and are primitive recursive (composed from the zero function and a composition of factorial and subtraction respectively). Therefore $f(n)$ is primitive recursive.



I'm kind of wondering about using bounded search like this to search inside an interval that doesn't start at zero. I feel it is correct since the predicate is still primitive recursive but I'm not sure if it's sufficient justification. What do you guys think?
 
Physics news on Phys.org
  • #2
I think your reasoning is fine.

Bacterius said:
we define $f(n + 1)$ as "the least $x$ less than or equal to $f(n)! - f(n)$ such that $x + f(n) + 1$ is prime".
Are you saying this instead of "the least $f(n)<x\le f(n)!+1$ such that $x$ is prime" because you need to search in an interval that starts with 0? That's OK, but it is also possible to define an auxiliary primitive recursive function that searches for the least number satisfying a p.r. relation in any bounded interval.
 

Related to Showing the nth prime is primitive recursive

What is "Showing the nth prime is primitive recursive"?

"Showing the nth prime is primitive recursive" refers to a mathematical proof that demonstrates the primitive recursive nature of the nth prime number. This means that the formula for calculating the nth prime number can be expressed using primitive recursive functions, which are computable mathematical functions.

Why is it important to show that the nth prime is primitive recursive?

Showing that the nth prime is primitive recursive has important implications in the field of theoretical computer science. It provides a deeper understanding of the nature of prime numbers and their relationship to computability. This knowledge can be applied in various fields, such as cryptography and algorithm design.

What is a primitive recursive function?

A primitive recursive function is a mathematical function that can be computed using only basic mathematical operations, such as addition, multiplication, and exponentiation, as well as primitive recursive functions. These functions are used in the study of computability and complexity theory.

How is the primitive recursive nature of the nth prime proven?

The primitive recursive nature of the nth prime can be proven using mathematical induction. This involves showing that the formula for calculating the nth prime number can be expressed using primitive recursive functions, and then demonstrating that this formula holds true for all values of n.

What are the implications of the proof that the nth prime is primitive recursive?

The proof that the nth prime is primitive recursive has significant implications in the field of theoretical computer science. It provides a better understanding of the complexity of prime numbers and their relationship to computability, which can be applied in various fields such as cryptography and algorithm design. It also contributes to the ongoing research and development of new computational methods and theories.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
2K
Replies
5
Views
943
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
849
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
784
  • Programming and Computer Science
Replies
1
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
Back
Top