Question: A vector is given by x = [ 4 9 7 5 9 8 7 6 5 1 3 5 2 2 1 1 7

A vector is given by x =[49759876513522117723974499].
Using conditional statements, loops and your testprime function from previous step write a MATLAB program that creates two vectors from x. The first vector (call it P) contains elements of x which are prime numbers, and the second vector (call it N) contains the non-prime elements of x. In both P and N, the elements are in the same order as in x. At the end of the program, display P and N as follows:
The prime vector is:
759135112397
The non-prime vector is:
49876522774499
 A vector is given by x =[49759876513522117723974499]. Using conditional statements, loops

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!