Class HailstoneSequence

Contains the results of computing a hailstone sequence.

Constructors

  • Initialise and compute a new Hailstone Sequence.

    Parameters

    • initialValue: bigint

      The value to begin the hailstone sequence from.

    • P: bigint

      Modulus used to devide n, iff n is equivalent to (0 mod P).

    • a: bigint

      Factor by which to multiply n.

    • b: bigint

      Value to add to the scaled value of n.

    • maxTotalStoppingTime: number

      Maximum amount of times to iterate the function, if 1 is not reached.

    • totalStoppingTime: boolean

      Whether or not to execute until the "total" stopping time (number of iterations to obtain 1) rather than the regular stopping time (number of iterations to reach a value less than the initial value).

    Returns HailstoneSequence

    the hailstone sequence computed for the parameters provided.

    Throws

    FailedSaneParameterCheck Thrown if either P or a are 0.

Properties

terminalCondition: SequenceState

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: number

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: ((_) => boolean)

The stopping time terminal condition

Type declaration

    • (_): boolean
    • Parameters

      • _: bigint

      Returns boolean

values: bigint[]

The set of values that comprise the hailstone sequence.

Generated using TypeDoc