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 · nerdamer API · Direct API

Nerdamer Notation

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

isprime(arg1)

nerdamer.isPrime

Call the operation through the default nerdamer import.

nerdamer.isPrime(x: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputExpression-compatible value to test.

Returns

Expression — 1 for prime integers, 0 for composite integers, or an unevaluated symbolic call.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { isPrime } from 'nerdamer/algebra';
isPrime(x: ExpressionInput): Expression

Parameters

NameTypeDescription
xExpressionInputExpression-compatible value to test.

Returns

Expression — 1 for prime integers, 0 for composite integers, or an unevaluated symbolic call.

Browse nerdamer/algebra →

Related API names

isPrime

← Back to Function reference