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

3646 Solutions

1016 Solvers

Last Solution submitted on Jan 10, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers1016

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!