Question: Write a function is Prime (a_nNum) that takes a positive integer as an argument and returns True if the argument is a prime number,

Write a function is Prime (a_nNum) that takes a positive integer as an argument and returns True if the

Write a function is Prime (a_nNum) that takes a positive integer as an argument and returns True if the argument is a prime number, or False otherwise. A prime number is a number that is only evenly divisible by itself and 1. Then, write a function listOfPrimes (a_nSize) that takes a number as an argument and returns a list of the first a_nSize prime numbers. Use the previously defined isPrime (a_nNum). Finally, test your function listOfPrimes (a_nSize). Hint: Recall that the % operator divides one number by another and returns the remainder of the division. Example: listOfPrimes (10) returns [2, 3, 5, 7, 11, 13, 17, 19, 23, 29].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

C 1 5 MA C ... View full answer

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 Programming Questions!