Question: Write a procedure ISPRIME whose input is a positive integer n and whose output is true if n is prime and false otherwise. Test the

Write a procedure ISPRIME whose input is a positive integer n and whose output is true if n is prime and
false otherwise. Test the procedure on the following numbers:
1,2,3,4,11,111,531,7919,15689,262681
The answers should be
false, true, true, false, true, false, false, true, false, true.
Hint: Here's a start for the program:local d;
if n 2 then return false; end if;
if n =2 then return true; end if;
Write a procedure ISPRIME whose input is a

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