Question: Question 4a: Next Prime (3 points) Write a function called next_prime which takes a positive number n as an input and returns the next prime

 Question 4a: Next Prime (3 points) Write a function called next_prime

Question 4a: Next Prime (3 points) Write a function called next_prime which takes a positive number n as an input and returns the next prime number greater than n Recall: A prime number is a number greater than 1 whose only factors are 1 and itself For example, the result of next_prime(2) should be 3 and next_prime (15) should be 17 In [3]: # Your code here In [51]: out [51]: In [54]: next-prime(40)=41 True next_prime (41)-43 Out[54]: True In [55]: next_prime (151)--157 out [55]: True In [ ]: # HIDDEN TESTS In [ ]: | # HIDDEN TESTS In [ ]: | # HIDDEN TESTS

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!