2 attachmentsSlide 1 of 2

- attachment_1attachment_1
- attachment_2attachment_2

### UNFORMATTED ATTACHMENT PREVIEW

1. [5 marks] Write a Scheme program in the file IsPrime.scm that reads in a number from the console and determines if it is a prime number. Input: One integer (greater than 1) read from the console, e.g., 42 Processing: Here is the algorithm (which you will need to adapt). isprime (num): for i in range (2, num): if num % start == 0: return True return false Output: Output a true (#t) or false (#f) depending on whether the number is prime or not. E.g., the output for an input of 42 would be #f See a list of functions below that you may find helpful. 2. [5 marks) Write a Scheme program in a file called Factors.scm that computes a list of the prime factors of a number. Input: One integer (greater than 1) read from the console, e.g., 84 Processing: Here is the algorithm (which you will need to adapt). factors (num): list = [] start = 2 while num != 1: if num % start == 0: list.add(num) num – num / start else: start = start + 1 return list Hint: In a recursive algorithm, build the list backwards from end to start. Output: Output a list of factors for the number E.g., for the above input, the output is: (2 2 3 7) See a list of functions below that you may find helpful.

Do you similar assignment and would want someone to complete it for you? Click on the **ORDER NOW** option to get instant services at **essayloop.com**

Do you have a similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com. We assure you of a well written and plagiarism free papers delivered within your specified deadline.