All published worksheets from http://sagenb.org
Image: ubuntu2004
Tutorial 19 August
Here are some examples of plotting functions:
Problem 1
Use plotting of the functions and to find out roughly for which the function becomes larger than .
Problem 2
The following is from Question 4 of the final exam of MTH110 last year (now we do this in Python):
The Goldbach Conjecture asserts that every even integer greater than 2 can be written as the sum of two primes.
a) Write and test a Python function PrimeSum(n) which returns true if n is the sum of two odd primes and returns false otherwise. You can assume that n is a positive integer.
Hints: Use a for-loop with x running from 3 to n-3 and test if x and n-x are both primes. The built-in function is_prime(x) can be used to test if x is prime.
b) Write and test Python function Goldbach(a,b) which returns true if the Goldbach Conjecture is correct for all even n with 2a<=n<=2b and false otherwise.