Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/collatz/lib/esm/index.mjs>HailstoneSequence

Functions related to the Collatz/Syracuse/3N+1 problem.
Latest
class HailstoneSequence
Re-export
import { HailstoneSequence } from "https://deno.land/x/collatz@javascript-v1.2.0/lib/esm/index.mjs";

Contains the results of computing a hailstone sequence.

Constructors

new
HailstoneSequence(
initialValue,
P,
a,
b,
maxTotalStoppingTime,
totalStoppingTime,
)

Initialise and compute a new Hailstone Sequence.

Properties

terminalCondition

A terminal condition that reflects the final state of the hailstone sequencing, whether than be that it succeeded at determining the stopping time, the total stopping time, found a cycle, or got stuck on zero (or surpassed the max total).

terminalStatus

A status value that has different meanings depending on what the terminal condition was. If the sequence completed either via reaching the stopping or total stopping time, or getting stuck on zero, then this value is the stopping/terminal time. If the sequence got stuck on a cycle, then this value is the cycle length. If the sequencing passes the maximum stopping time then this is the value that was provided as that maximum.

terminate

The stopping time terminal condition

values

The set of values that comprise the hailstone sequence.