Question: This is in MATLAB !! Need help with this. I know how to do MATLAB prime numbers normally, but I do not know how to

 This is in MATLAB!! Need help with this. I know how

This is in MATLAB!! Need help with this. I know how to do MATLAB prime numbers normally, but I do not know how to do the prime numbers with the required functions and method, (ex. the NaN function, and floorsqrt(n) function, etc...) Im not sure how to store the non prime numbers in an array either. Please make sure to fully read the prompt for all specific requirements, they are highlighted. Please run your code through MATLAB to make sure it works, it doesnt help if I get incomplete or partial script. Thank you.

Question 2 You will improve on the previous C++ primes assignment by implementing a different algorithm. Find prime numbers in this assignment and store them within an array. Assume you are finding all the prime number 20. Starting at 2, set all multiples of 2 larger than 2 to NaN. 2 3 4 5 Y6 7 8 9 N00 11 12 13 14 15 M6 17 N8 19 20 Then do that again for the next higher number, 3 2 3 4 5 6 7 8 9 No 11 12 13 H4 15 16 17 18 19 20 And then again for 4 and so on up to floor (sart (n) using a nested for loop At the end of this, all values that are not NaN at some stage is a prime on n. Then you must use isnan to identify and filter NaN values, and restore the prime array that contains only numbers. Write this code into a script named hw10b.m. Sample output: Enter a number: 20 Prime numbers are: 13 17 19 11

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!