Algosim documentation: IsPrime

IsPrime

Determines if a given integer is prime.

Syntax

Description

If n is an integer, then IsPrime(n) is true iff n is a prime number. A prime number is a positive integer n greater than or equal to 2 whose only positive divisors are 1 and n.

Examples

IsPrime(7355242453)
false
filter(SequenceVector(100), IsPrime)
(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
count(SequenceVector(1000000), IsPrime)
78498

See also