Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

primes

Prime numbers less than or equal to input value

Syntax

  • p = primes(n)

Input argument

  • n - scalar, real integer value

Output argument

  • p - vector with prime numbers.

Description

p = primes(n) returns a row vector containing all the prime numbers less than or equal to n.

The data type of p is the same as that of n.

Example

p = primes(15)

See also

factor.

History

VersionDescription
1.0.0initial version

Author

Allan CORNET