Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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) wite a function that takes dan 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 tthan 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

1 #!/usr/bin/env python3 # -*- coding: utf-8 -* - AF AF AF Created on Mon Feb 1 11:06:30 2021 fauthor: Lance 2 3 4 5 6 7 8 9 10 11 12 AF LF UT def isprime(x): if x % 2 == 0: return false d = 3 done = False 14 15 16 17 18 19 20 result = True bound = round(x**(1/2)) 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

=+How should it be delivered?

Answered: 1 week ago

Question

=+4 How does one acquire a global mindset?

Answered: 1 week ago