Problem 981. Find nearest prime number less than input number

Created by Reza Ahmadzadeh in Community

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

32.24% Correct | 67.76% Incorrect
Last solution submitted on Feb 16, 2019

Problem Comments

Solution Comments

Recent Solvers123

Suggested Problems

More from this Author11

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!