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

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

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

Returns the stopping time, the amount of iterations required to reach a value less than the initial value, or null if maxStoppingTime is exceeded. Alternatively, if totalStoppingTime is True, then it will instead count the amount of iterations to reach 1. If the sequence does not stop, but instead ends in a cycle, the result will be (Double.POSITIVE_INFINITY). If (P,a,b) are such that it is possible to get stuck on zero, the result will be the negative of what would otherwise be the "total stopping time" to reach 1, where 0 is considered a "total stop" that should not occur as it does form a cycle of length 1.

Parameters

unnamed 0
  • Allows non-default (P,a,b); and other options.