Question: Discrete Math Describe a non-recursive algorithm that takes a list of distinct integers a_1, a_2, ellipsis, a_n and determines whether they are all prime. Write
Describe a non-recursive algorithm that takes a list of distinct integers a_1, a_2, ellipsis, a_n and determines whether they are all prime. Write your answer in pseudo-code or any well-known procedural language like Python, Java, C++, ellipsis. You may assume that a function "prime?" has been defined, where "prime?" applied to an prime number returns TRUE and "prime?" applied to a composite number returns FALSE. E.g. For the list 2, 3, 4. 5, 6, 7, your program should return false (because not all of the numbers are prime) procedure All prime?(a_1, a_2, ellipsis, a_n: integers)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
