Problem 44384. Find the nearest prime number
31.0% Correct | 69.0% Incorrect
Last Solution submitted on Mar 17, 2023
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?
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
Back to basics 9 - Indexed References
Sum of first n terms of a harmonic progression
Predicting life and death of a memory-less light bulb
More from this Author44
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!