Discover MakerZone

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

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!

Problem 1722. Find the next prime number

Created by Chris E.

Find the next prime number or numbers for given n. For example:

n = 1;
out = 2;


n = [5 7];
out = [7 11];

Good luck!


Problem Group

Solution Statistics

50 correct solutions 28 incorrect solutions
Last solution submitted on Nov 26, 2015