# checknumprime

> Check if a number is prime

Latest version **1.0.4** (published 2017-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install checknumprime
pnpm add checknumprime
yarn add checknumprime
bun add checknumprime
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2017-02-03 |
| First published | 2017-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | PgSuper |
| Maintainers | pgsuper |
| Keywords | math, prime, numbers |

## Links

- npm: https://www.npmjs.com/package/checknumprime
- Repository: https://github.com/PgBiel/checknumprime
- Homepage: https://github.com/PgBiel/checknumprime#readme
- Issues: https://github.com/PgBiel/checknumprime/issues
- npm.io page: https://npm.io/package/checknumprime

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2017-02-03
- 1.0.3 — 2017-02-03
- 1.0.2 — 2017-02-03
- 1.0.1 — 2017-02-03
- 1.0.0 — 2017-02-03

## README

# checknumprime

To check if a number is prime. Make sure you give a number under 4294967295
It, however, does only accept 1 as a prime IF you feed `true` as the 2nd argument. By default it returns 1 and -1 as NOT prime.
**Maximum accepted number is Number.MAX_SAFE_INTEGER** (9007199254740991) **and the Minimum is Number.MIN_SAFE_INTEGER** (-9007199254740991).

#### Node.js:
npm package: `npm install checknumprime`

```js
var isPrime = require("checknumprime").isPrime;
isPrime(2); //true
isPrime(9); //false
isPrime(1); //false
isPrime(1, true); //true
isPrime(-1); //false
isPrime(-1, true); //true
```

#### Browser:
```html
<script src="https://cdn.rawgit.com/PgBiel/checknumprime/master/main.js"></script>
```
then
```js
//isPrime gets defined in window
isPrime(2); //true
```

---
_Source: https://npm.io/package/checknumprime · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
