Problem 44384. Find the nearest prime number
Solution Stats
Problem Comments
-
1 Comment
Test case No. 5
x = 911;
y_correct = 911;
Should the nearest prime number for 911 have been 907?
Solution Comments
-
1 Comment
how i can solve
which is wrong
-
1 Comment
Look. It's Size 80
-
1 Comment
I feel for you, typing in those endless arrays of prime numbers.
You have probably figured it out by now, but instead of typing in manually the vectors prim0 and prim1 and then checking memberships, you can just run the function 'isprime(x)' which will save you lots of space and time
Problem Recent Solvers610
Suggested Problems
-
Select every other element of a vector
28170 Solvers
-
6202 Solvers
-
Create a Multiplication table matrix...
375 Solvers
-
Create an n-by-n null matrix and fill with ones certain positions
485 Solvers
-
Sums of Multiple Pairs of Triangular Numbers
227 Solvers
More from this Author44
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!