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
-
Project Euler: Problem 7, Nth prime
1129 Solvers
-
333 Solvers
-
Sum of first n terms of a harmonic progression
364 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
1346 Solvers
-
679 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!