Problem 60977. Linear primes p' = mp + n

Problem statement
List the prime numbers of the form p' = mp + n for a given (m,n) couple and such that p' < k, k positive integer.
Examples
  • (m,n) = (3,2) and k = 50 => p = [11, 17, 23, 41];
  • (m,n) = (4,3) and k = 50 => p = [11, 23, 31, 47];
  • (m,n) = (5,4) and k = 100 => p = [19, 29, 59, 89];
Forbidden functions / expressions
  • regexp
  • assignin
  • str2num
  • echo
See also

Solution Stats

75.0% Correct | 25.0% Incorrect
Last Solution submitted on Aug 18, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers11

Suggested Problems

More from this Author42

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!