Write a user-defined function that determines if a number is a prime number. Name the function pr=Trueprime(m), where the input arguments m is a positive integer and the output argument pr is 1 if m...



Write a user-defined function that determines if a number is a prime number. Name the function pr=Trueprime(m), where the input arguments m


is a positive integer and the output argument pr is 1 if m is a prime number


and 0 if m is not a prime number. Do not use MATLAB’s built-in functions


primes and isprime. If a negative number or a number that is not an


integer is entered when the function is called, the error message “The input


argument must be a positive integer.” is displayed.


(a) Use the function with 733, 2001, and 107.5.


(b) Write a MATLAB program in a script file that makes use of Trueprime and finds the smallest prime number that remains a prime number


when added to its reverse (37 is the reverse of 73).

Nov 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here