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)
// → 1Reject a composite integer.
isprime(21)
// → 0Treat 1 as non-prime.
isprime(1)
// → 0Interfaces
The same operation is available through the interfaces below.
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
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | Expression-compatible value to test. |
Returns
Expression — 1 for prime integers, 0 for composite integers, or an unevaluated symbolic call.
Direct JavaScript / TypeScript API
Import the operation directly from its package entry point.
import { isPrime } from 'nerdamer/algebra';
isPrime(x: ExpressionInput): Expression
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | Expression-compatible value to test. |
Returns
Expression — 1 for prime integers, 0 for composite integers, or an unevaluated symbolic call.
Related API names
isPrime
