Function Reference
— Function File: isprime (n)

Return true if n is a prime number, false otherwise.

Something like the following is much faster if you need to test a lot of small numbers:

             t = ismember (n, primes (max (n (:))));

If max(n) is very large, then you should be using special purpose factorization code.

See also: primes factor gcd lcm