using MatLab, please help!
INPUT n - positive integer OUTPUT p is an array of prime numbers less than or equal to n. (Tn) is the number of prime numbers less than or equal to n.) i=0 for c= 2,...n for d = 2, 3, ...k-1 if remainder(c/d) = 0 then c is composite, stop loop and go to next c value end if statement end for loop If inner loop cycled all the way through then i = i +1 then pi=c end if statement end for loop The algorithm can be summarized in this way. Consider whether each integer from 2 to n is prime by dividing it by all integers greater than 1 and less than the number being considered. If one of those lesser numbers divides evenly into our candidate prime, then it's composite. Otherwise it is prime and we add that candidate number to the list. This algorithm is implemented in the code prime_list slow.m. As the code name sug- gests, we can accelerate the speed of the code. That is the subject of this homework. Theorem 1 If n is not divisible by any prime number less than n, then n is a prime number. Theorem 2 If n is not divisible by any integer between two and n, then n is prime. 3. (20 points) Create a Matlab function, titled prime list that implements your pseu- docode above. Your function should have the following input and output: Input n - positive integer Output p- an array of prime number less than or equal to n The first line of your code should therefore read: function p = prime list(n). Consider the following alternate method for computing a list or prime numbers, (known as the Sieve of Eratosthenes) INPUT n - positive integer OUTPUT p is an array of prime numbers less than or equal to n. ((n) is the number of prime numbers less than or equal to n.) p= array of integers 1 through n Pi = 0. for k = 2,3,.... n If Pk 70 then set p; = 0 for j = K2, 42 + k, k2 + 2k, ...,n end If statement end for loop Extract all nonzero elements of the array p. 4. (20 points) Create a Matlab function, titled prime sieve that implements the pseu- docode above. Your function should have the following input and output: Input n - positive integer Output p- an array of prime number less than or equal to n