Showing the nth prime is primitive recursive

  • Context: MHB 
  • Thread starter Thread starter Nono713
  • Start date Start date
  • Tags Tags
    Prime Primitive
Click For Summary
SUMMARY

The function $f(n)$, which returns the $n$th prime number, is proven to be a primitive recursive function. The proof utilizes the prime decision function $p(x)$, which is primitive recursive, and establishes the base case with $f(0) = 2$. The function $f(n + 1)$ is defined using bounded search within the interval $[f(n) + 1, f(n)! + 1]$, confirming that $f(n)$ returns the $n$th prime for all natural numbers $n$. The discussion also addresses the validity of using bounded search in intervals that do not start at zero.

PREREQUISITES
  • Understanding of primitive recursive functions
  • Familiarity with the prime decision function
  • Knowledge of bounded search techniques
  • Basic concepts of mathematical induction
NEXT STEPS
  • Study the properties of primitive recursive functions in detail
  • Learn about the prime decision function and its implications
  • Explore bounded search techniques in primitive recursion
  • Investigate auxiliary primitive recursive functions for bounded intervals
USEFUL FOR

Mathematicians, computer scientists, and students studying recursion theory, particularly those interested in the properties of prime numbers and primitive recursive functions.

Nono713
Gold Member
MHB
Messages
615
Reaction score
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
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.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K