Context and problem statement
Legendre's conjecture states for a given positive integer n, there always exists at least one prime number p between 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

50 Solutions

37 Solvers

Last Solution submitted on Feb 06, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...