Context and problem statement
Legendre's conjecture states for a given positive integer n, there always exists at least one prime number p between n² and (n+1²) :
For a given input n, List the prime number(s) p in the interval ]n^2; (n+1)^2[.
Examples
- n = 1 => p = [2, 3];
- n = 2 => p = [5, 7];
- n = 10 => p = [101, 103, 107, 109, 113];
- n = 20 => p = [401, 409, 419, 421, 431, 433, 439];
Forbidden functions / expressions
- regexp
- assignin
- str2num
- echo
See also
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Group
Problem Recent Solvers38
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!