Question: Task 2 : Two prime number - related functions a ) Write your own MATLAB ( or Octave ) function to check if a number

Task 2: Two prime number-related functions
a) Write your own MATLAB (or Octave) function to check if a number is a prime.
Your function shall take a natural number as an input and return a boolean value to
indicate if the input number is prime (return value true) or not (return value false).
b) Write a MATLAB (or Octave) function which takes a number n as an input parameter
and returns a vector which contains the rst n prime numbers.
You are only allowed to use basic arithmetics (addition, subtraction, multiplication,
division, modulo) together with if/else-branching, for-loops and while-loops for this
part of the project.

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