Skip to content

list_primes

miscellaneous · scripts/miscellaneous/list_primes.m

LIST_PRIMES  First N prime numbers as a row vector.
  P = LIST_PRIMES () returns the first 25 primes.
  P = LIST_PRIMES (N) returns the first N primes (N floored). Empty when
  N < 1. Floating / integer class of N is preserved on the result when
  representable; other types (including logical/char) yield double.

  Octave-compatible public name. MATLAB has no public list_primes;
  portable code uses primes / isprime. Unmarked MATLAB-mode scripts that
  never call this name are unaffected.

  See also PRIMES, ISPRIME.