Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1.17. An alternative proof of Theorem 1.5.1, to the effect that there ar

ID: 3707755 • Letter: P

Question

Problem 1.17. An alternative proof of Theorem 1.5.1, to the effect that there are infinitely many primes, begins as follows. Assume for a contradiction that the set of prime numbers is finite. Let p be the largest prime. Consider x - p! and y-x+1. Your problem is to complete the proof from here and to distill from your proof an algorithm Biggerprime(p) that finds a prime larger than p. The proof of termination for your algorithm must be obvious, as well as the fact that it returns a value larger than p.

Explanation / Answer

Java code:

int Biggerprime(p)

{

boolean flag=true;

while(flag)

{

p=p+1;

int count=0;

for(int i=1;i<=p;p++)

{

if(p%i == 0)

{

count=count+1;

}

}

if(count==2)

{

flag=false;

return p;

}

}

Algorithm:

Take the input p;

Set flag=true until you find the prime number which is bigger than p

Start from the number p, check the number is prime or not while incresing the number by usinha loop

If you find any prime number in this loop,set flag false,so that the loop iteration stops next.

Return the prime number which has been found in the loop.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote