Problem 44384. Find the nearest prime number
Solution Stats
Problem Comments
-
1 Comment
Tran Hiep Dinh
on 21 Mar 2019
Test case No. 5
x = 911;
y_correct = 911;
Should the nearest prime number for 911 have been 907?
Solution Comments
-
1 Comment
Mehedi Hasan
on 13 Feb 2020
how i can solve
which is wrong
-
1 Comment
Francis Naldo
on 29 Dec 2017
Look. It's Size 80
-
1 Comment
Igor Gaponov
on 21 Dec 2017
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
-
3651 Solvers
-
Back to basics 9 - Indexed References
427 Solvers
-
Sum of first n terms of a harmonic progression
365 Solvers
-
Predicting life and death of a memory-less light bulb
319 Solvers
-
249 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!