Skip to main content

is_prime(n)

Signature: is_prime(n: int) -> bool

Determines primality for positive integers using a straightforward trial method optimized by checking 2 and 3 and then stepping by 6.

Example

function example() returns null {
print(is_prime(17)); # true
}