everyutil
Version:
A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.
9 lines (8 loc) • 336 B
TypeScript
/**
* Generates the Collatz sequence for a given starting number.
* For example, collatzSequence(6) returns [6, 3, 10, 5, 16, 8, 4, 2, 1].
* @author @dailker
* @param {number} n - The starting number.
* @returns {number[]} The Collatz sequence as an array.
*/
export declare function collatzSequence(n: number): number[];