Question: Download the file prime.py, which contains the function isprime that checks if a number is prime. We disscussed this function in class. Copy this function

 Download the file prime.py, which contains the function isprime that checks

Download the file prime.py, which contains the function isprime that checks if a number is prime. We disscussed this function in class. Copy this function into your file.

Here is the Goldbarch Conjecture:

Every even natural number greater that 3 is the sum of 2 primes.

1) write a function that takes an even number as input and either prints out a way that the number can be written as the sum of two primes (there may be more than one, just print one) or prints a message that the conjecture is false.

2) Modify your function to another one that returns True iif the conjecture is true for n and False if n can't be written as the sum of two primes.

3) Use the function in part 2 to check if the conjecture is true for all even numbers from 6 to 100,000.

please use python 3 for the program

def isprime(x): if x % 2 == 0: return false d = 3 done = False result = True bound = round(x**(1/2)) 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 while not done: print(d) if x % d == 0: result = False done = True print(d, x//d) else: d = d + 2 if d> bound: done = True return result 36 37 38 39

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!