> For the complete documentation index, see [llms.txt](https://osl.mistium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://osl.mistium.com/methods/numbers/.isprime.md).

# .isPrime()

## Description

isPrime returns a boolean indicating whether the input number is prime (a number greater than 1 that is only divisible by 1 and itself).

## Parameters

isPrime takes no parameters.

## Usage On Numbers

```javascript
// Basic usage
num = 17
log num.isPrime()
// true
// 17 is prime

num = 16
log num.isPrime()
// false
// 16 is not prime (divisible by 1, 2, 4, 8, 16)

// Works with larger numbers
log 997.isPrime()
// true
// 997 is prime

// Special cases
log 1.isPrime()
// false
// 1 is not considered prime by definition

log 2.isPrime()
// true
// 2 is the smallest and only even prime number

// Negative numbers and zero are not prime
log (-7).isPrime()
// false

log 0.isPrime()
// false
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://osl.mistium.com/methods/numbers/.isprime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
