Cody

Problem 45201. Check if integer is a prime number

Solution 2062405

Submitted on 18 Dec 2019 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
assert(isequal(isPrime(2),true))

ans = logical 1

2   Pass
assert(isequal(isPrime(1),false))

ans = logical 0

3   Pass
assert(isequal(isPrime(3),true))

ans = logical 1

4   Pass
assert(isequal(isPrime(11),true))

ans = logical 1

5   Pass
assert(isequal(isPrime(97),true))

ans = logical 1

6   Pass
assert(isequal(isPrime(199),true))

ans = logical 1

7   Pass
assert(isequal(isPrime(65),false))

ans = logical 0

8   Pass
assert(isequal(isPrime(93),false))

ans = logical 0

9   Pass
assert(isequal(isPrime(77),false))

ans = logical 0

Suggested Problems

More from this Author5

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!