Python Loops assignment help

computer science


Python Loops

Part 1:  Determine if a number is Prime

A positive whole number, n > 2, is prime if no number between 2 and the square root of (inclusive) evenly divides n.  Write a program that accepts a value of n as input, and determines if the value is prime.  If n is no prime, your program should quit as soon as it finds a value that evenly divides n.

Part 2:  Lists of Prime Numbers

Modify your program to find every prime number less than or equal to n.    [Hint: add an outer loop]

Part 3:  Goldbach Conjecture  (BONUS  20 pts Extra Credit)

The Goldbach conjecture asserts that every even number is the sum of two prime numbers.  Write  a program that gets a number from the user, checks to make sure that it is even, then finds two prime numbers that add up to the number.

Related Questions in computer science category

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.