Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

nodejs-prho

Pollard's rho algorithm implemented in Node.js with long arithmetics

gcd, prho, prime factorization, pollard rho algorithm

readme

nodejs-prho

Pollard's rho algorithm implemented in Node.js

Documentation

Wiki - https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm

Inspiration

Codepen - https://codepen.io/michaelsknobloch/pen/Kzqeyb

Reasoning

Solved infinite loops, which can happen on some numbers in https://www.npmjs.com/package/prho package, with recursive approach from https://codepen.io/michaelsknobloch/pen/Kzqeyb and usage of different functions to find factors to prevent stucking. Also it support long arithmetics with native BigInt JS object.

Installation

$ npm install prho
$ yarn add nodejs-prho

Usage

const prho = require('nodejs-prho')
const factors = prho(420n)
// => [2 , 2 , 3 , 5 , 7]