# pollardsrho

> integer factorization using Pollard's rho algorithm with Brent cycle detection, Miller–Rabin primality test

Latest version **1.0.9** (published 2025-01-01) · 0 weekly downloads

## Install

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

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2025-01-01 |
| First published | 2024-04-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | yaffle |
| Keywords | integer, factorization, Pollard's, rho, algorithm, Miller, Rabin, prime, testing |

## Links

- npm: https://www.npmjs.com/package/pollardsrho
- Repository: https://github.com/Yaffle/PollardsRho
- Homepage: https://github.com/Yaffle/PollardsRho#readme
- Issues: https://github.com/Yaffle/PollardsRho/issues
- npm.io page: https://npm.io/package/pollardsrho

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2025-01-01
- 1.0.8 — 2024-12-30
- 1.0.7 — 2024-11-05
- 1.0.6 — 2024-05-04
- 1.0.5 — 2024-05-04
- 1.0.4 — 2024-05-04
- 1.0.1 — 2024-04-20

## README

1. Integer factorization using Pollard's rho algorithm with Brent cycle detection

Usage:

```
import PollardsRho64 from './PollardsRho64.js';

console.log(PollardsRho64(2n**64n - 585n, 2**20)); // 9094863431n


import PollardsRho from './PollardsRho.js';

console.log(PollardsRho(2n**64n - 585n, 2**20)); // 9094863431n

```

PollardsRho64 is only for 64 bit unsigned integers.
Do not call for prime numbers. It is very slow for them.
The second argument is maximum number of steps, you can use 2**20.

2. Prime testing using Miller-Rabin algorithm:

Usage:

```
import isPrime64 from './isPrime64.js';

console.log(isPrime64(2n**64n - 585n) === 0); // false


import isPrime from './isPrime.js';

console.log(isPrime(2n**64n - 585n)); // false

```

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