Find nearest prime number less than input number - MATLAB Cody - MATLAB Central

Problem 981. Find nearest prime number less than input number

Difficulty:Rate

Find nearest prime number less than input number.

For example: if the input number is 125, then the nearest prime number which is less than this number is 113.

Be careful, in that 1 is not a prime number. So there is NO prime less than 2.

Solution Stats

28.73% Correct | 71.27% Incorrect
Last Solution submitted on May 06, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers866

Suggested Problems

More from this Author11

Problem Tags

Community Treasure Hunt

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

Start Hunting!