@skenvy/collatz
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Collatz: JavaScript 🟨🟦🟩🟥

Banner Image, Collatz Coral

Colourised Collatz Coral; derived from this original by Edmund Harriss


Functions related to the Collatz/Syracuse/3N+1 problem, implemented in JavaScript (transpiled from TypeScript).

Getting Started

To install the latest from npm;

npm i @skenvy/collatz

Also available on deno. See the typescript import, the CommonJS import, or the ECMAScript import.

Usage

Provides the basic functionality to interact with the Collatz conjecture. The parameterisation uses the same (P,a,b) notation as Conway's generalisations. Besides the function and reverse function, there is also functionality to retrieve the hailstone sequence, the "stopping time"/"total stopping time", or tree-graph. The only restriction placed on parameters is that both P and a can't be 0.

Developing

The first time setup

git clone https://github.com/Skenvy/Collatz.git && cd Collatz/javascript && make install_npm && make setup

Iterative development

The majority of make recipes for this are just wrapping an invocation of npm run ... on one of the package.json's "scripts".

  • make docs will recreate the TypeDoc docs, based on TSDoc comments.
  • make test will run the mocha tests and attempt a dry run of the publishing.
  • make lint will run eslint.
  • make verify_transpiled_checkin will confirm you haven't forgotten to check in changes to the transpiled output.
  • make build will run npm pack after linting, testing, and verifying check-in.

Package Sidebar

Install

npm i @skenvy/collatz

Weekly Downloads

4

Version

1.2.0

License

Apache-2.0

Unpacked Size

127 kB

Total Files

53

Last publish

Collaborators

  • skenvy