Function reference · Special functions

isprime

Returns 1 if an integer is prime, and 0 otherwise.

In Notation it is isprime; in JavaScript, isPrime. For a symbol, the call is returned unevaluated.

Notation

isprime(x)

Write it in an expression: nerdamer('isprime(29)'), or in the Playground.

nerdamer.isprime

nerdamer.isPrime(x: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

import { isPrime }

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

Import only this function, from nerdamer/algebra.

Examples

A prime.

isprime(29)
// → 1
Open in Playground

3·7.

isprime(21)
// → 0
Open in Playground

1 isn't prime.

isprime(1)
// → 0
Open in Playground

A large prime.

isprime(2^61-1)
// → 1
Open in Playground

Also called

isPrime

← Back to Function reference