Function reference · Special functions

isPrime

Tests whether an exact integer is prime.

Use isprime(...) in Nerdamer Notation and isPrime(...) from the JavaScript / TypeScript API.

Exact integer inputs return 1 for prime and 0 for non-prime values. Inputs that cannot be classified as exact integers remain symbolic.

Examples

These examples use Nerdamer Notation.

Recognize a prime integer.

isprime(29)
// → 1

Reject a composite integer.

isprime(21)
// → 0

Treat 1 as non-prime.

isprime(1)
// → 0

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · Direct API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

isprime(arg1)

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { isPrime } from 'nerdamer/algebra';

Browse nerdamer/algebra

Aliases

isprime

← Back to Reference