@mojir/lits 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -8
- package/dist/cli/cli.js +1264 -909
- package/dist/cli/src/Lits/Lits.d.ts +8 -2
- package/dist/cli/src/builtin/bindingNode.d.ts +2 -1
- package/dist/cli/src/builtin/interface.d.ts +3 -2
- package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/cli/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/cli/src/evaluator/index.d.ts +3 -2
- package/dist/cli/src/evaluator/interface.d.ts +3 -2
- package/dist/cli/src/utils/maybePromise.d.ts +54 -0
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +1 -1
- package/dist/lits.iife.js.map +1 -1
- package/dist/modules/assert.esm.js +1 -1
- package/dist/modules/assert.esm.js.map +1 -1
- package/dist/modules/assert.js +1 -1
- package/dist/modules/assert.js.map +1 -1
- package/dist/modules/collection.esm.js +1 -1
- package/dist/modules/collection.esm.js.map +1 -1
- package/dist/modules/collection.js +1 -1
- package/dist/modules/collection.js.map +1 -1
- package/dist/modules/grid.esm.js +1 -1
- package/dist/modules/grid.esm.js.map +1 -1
- package/dist/modules/grid.js +1 -1
- package/dist/modules/grid.js.map +1 -1
- package/dist/modules/number-theory.esm.js +1 -1
- package/dist/modules/number-theory.esm.js.map +1 -1
- package/dist/modules/number-theory.js +1 -1
- package/dist/modules/number-theory.js.map +1 -1
- package/dist/modules/sequence.esm.js +1 -1
- package/dist/modules/sequence.esm.js.map +1 -1
- package/dist/modules/sequence.js +1 -1
- package/dist/modules/sequence.js.map +1 -1
- package/dist/modules/src/Lits/Lits.d.ts +8 -2
- package/dist/modules/src/builtin/bindingNode.d.ts +2 -1
- package/dist/modules/src/builtin/interface.d.ts +3 -2
- package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/modules/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/modules/src/evaluator/index.d.ts +3 -2
- package/dist/modules/src/evaluator/interface.d.ts +3 -2
- package/dist/modules/src/utils/maybePromise.d.ts +54 -0
- package/dist/modules/vector.esm.js +1 -1
- package/dist/modules/vector.esm.js.map +1 -1
- package/dist/modules/vector.js +1 -1
- package/dist/modules/vector.js.map +1 -1
- package/dist/src/Lits/Lits.d.ts +8 -2
- package/dist/src/builtin/bindingNode.d.ts +2 -1
- package/dist/src/builtin/interface.d.ts +3 -2
- package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +2 -1
- package/dist/src/evaluator/functionExecutors.d.ts +2 -1
- package/dist/src/evaluator/index.d.ts +3 -2
- package/dist/src/evaluator/interface.d.ts +3 -2
- package/dist/src/utils/maybePromise.d.ts +54 -0
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-theory.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/typeGuards/number.ts","../../src/typeGuards/annotatedArrays.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/array.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/utils/arity.ts","../../src/builtin/modules/number-theory/docs.ts","../../src/builtin/modules/number-theory/binomialCefficient.ts","../../src/builtin/modules/number-theory/combinations.ts","../../src/builtin/modules/number-theory/derangements.ts","../../src/builtin/modules/number-theory/divisors.ts","../../src/builtin/modules/number-theory/sequences/factorial.ts","../../src/builtin/modules/number-theory/factorial.ts","../../src/builtin/modules/number-theory/sequences/partition.ts","../../src/builtin/modules/number-theory/partitions.ts","../../src/builtin/modules/number-theory/permutations.ts","../../src/builtin/modules/number-theory/powerSet.ts","../../src/builtin/modules/number-theory/primeFactors.ts","../../src/builtin/modules/number-theory/sequences/abundant.ts","../../src/utils/index.ts","../../src/builtin/modules/number-theory/sequences/arithmetic.ts","../../src/builtin/modules/number-theory/sequences/bernoulli.ts","../../src/builtin/modules/number-theory/sequences/prime.ts","../../src/builtin/modules/number-theory/sequences/composite.ts","../../src/builtin/modules/number-theory/sequences/deficient.ts","../../src/builtin/modules/number-theory/sequences/geometric.ts","../../src/builtin/modules/number-theory/sequences/golomb.ts","../../src/builtin/modules/number-theory/sequences/happy.ts","../../src/builtin/modules/number-theory/sequences/juggler.ts","../../src/builtin/modules/number-theory/sequences/lookAndSay.ts","../../src/builtin/modules/number-theory/sequences/lucky.ts","../../src/builtin/modules/number-theory/sequences/padovan.ts","../../src/builtin/modules/number-theory/sequences/perfectCube.ts","../../src/builtin/modules/number-theory/sequences/perfectPower.ts","../../src/builtin/modules/number-theory/sequences/perfectSquare.ts","../../src/builtin/modules/number-theory/sequences/poligonal.ts","../../src/builtin/modules/number-theory/sequences/recaman.ts","../../src/builtin/modules/number-theory/sequences/thueMorse.ts","../../src/builtin/modules/number-theory/sequences/tribonacci.ts","../../src/builtin/modules/number-theory/sequences/index.ts","../../src/typeGuards/string.ts","../../src/builtin/modules/number-theory/index.ts","../../src/builtin/modules/number-theory/sequences/collatz.ts","../../src/builtin/modules/number-theory/sequences/catalan.ts","../../src/builtin/modules/number-theory/sequences/fibonacci.ts","../../src/builtin/modules/number-theory/sequences/lucas.ts","../../src/builtin/modules/number-theory/sequences/mersenne.ts","../../src/builtin/modules/number-theory/sequences/pell.ts","../../src/builtin/modules/number-theory/sequences/perfect.ts","../../src/builtin/modules/number-theory/sequences/sylvester.ts","../../src/builtin/modules/number-theory/sequences/bell.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, LitsFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new LitsError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new LitsError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new LitsError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new LitsError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new LitsError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new LitsError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'abundant-seq': {\n category: 'number-theory',\n description: 'Generates the abundant numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(1)',\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(5)',\n ],\n seeAlso: ['number-theory.abundant-nth', 'number-theory.abundant-take-while', 'number-theory.abundant?', 'number-theory.deficient-seq', 'number-theory.perfect-seq'],\n },\n 'abundant-take-while': {\n category: 'number-theory',\n description: 'Generates the abundant numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { abundant-take-while } = import(\"number-theory\");\\nabundant-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.abundant?'],\n },\n 'abundant-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the abundant numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(1)',\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(5)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-take-while', 'number-theory.abundant?'],\n },\n 'abundant?': {\n category: 'number-theory',\n description: 'Checks if a number is abundant.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(12)',\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(15)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.deficient?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.abundant-take-while'],\n },\n 'arithmetic-seq': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence for a given $start, $step, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(3, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(2, 3, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-nth', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?', 'number-theory.geometric-seq'],\n },\n 'arithmetic-take-while': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-take-while } = import(\"number-theory\");\\narithmetic-take-while(1, 0.25, -> $ < 3)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.arithmetic?'],\n },\n 'arithmetic-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the arithmetic sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(3, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(2, 3, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?'],\n },\n 'arithmetic?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the arithmetic sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(3, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(2, 3, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.geometric?', 'number-theory.arithmetic-take-while'],\n },\n 'bell-seq': {\n category: 'number-theory',\n description: 'Generates the Bell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 22 (the maximum length of the pre-calculated bell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(5)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(10)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq()',\n ],\n seeAlso: ['number-theory.bell-nth', 'number-theory.bell-take-while', 'number-theory.bell?', 'number-theory.catalan-seq', 'number-theory.stirling-second', 'number-theory.stirling-first'],\n },\n 'bell-take-while': {\n category: 'number-theory',\n description: 'Generates the Bell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bell-take-while } = import(\"number-theory\");\\nbell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.bell?'],\n },\n 'bell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(5)',\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(10)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-take-while', 'number-theory.bell?'],\n },\n 'bell?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Bell sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell? } = import(\"number-theory\");\\nbell?(1)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644437)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644436)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.catalan?', 'number-theory.bell-take-while'],\n },\n 'bernoulli-seq': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence up to a specified length.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(5)',\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(10)',\n ],\n seeAlso: ['number-theory.bernoulli-nth', 'number-theory.bernoulli-take-while'],\n },\n 'bernoulli-take-while': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence while a condition is met.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-take-while } = import(\"number-theory\");\\nbernoulli-take-while(-> abs($) < 100)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-nth'],\n },\n 'bernoulli-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bernoulli sequence.',\n returns: {\n type: 'number',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(5)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(10)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(23)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-take-while'],\n },\n 'catalan-seq': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 30 (the maximum length of the pre-calculated catalan numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(5)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(10)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq()',\n ],\n seeAlso: ['number-theory.catalan-nth', 'number-theory.catalan-take-while', 'number-theory.catalan?', 'number-theory.bell-seq'],\n },\n 'catalan-take-while': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { catalan-take-while } = import(\"number-theory\");\\ncatalan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.catalan?'],\n },\n 'catalan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Catalan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(5)',\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-take-while', 'number-theory.catalan?'],\n },\n 'catalan?': {\n category: 'number-theory',\n description: 'Determines if a number is in the Catalan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(5)',\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.bell?', 'number-theory.catalan-take-while'],\n },\n 'collatz-seq': {\n category: 'number-theory',\n description: 'Generates the collatz sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the collatz sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(3)',\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(11)',\n ],\n seeAlso: ['number-theory.juggler-seq'],\n },\n 'composite-seq': {\n category: 'number-theory',\n description: 'Generates the composite sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(1)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(2)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(10)',\n ],\n seeAlso: ['number-theory.composite-nth', 'number-theory.composite-take-while', 'number-theory.composite?', 'number-theory.prime-seq'],\n },\n 'composite-take-while': {\n category: 'number-theory',\n description: 'Generates the composite sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { composite-take-while } = import(\"number-theory\");\\ncomposite-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.composite?'],\n },\n 'composite-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the composite sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the composite number to retrieve.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(1)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(2)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(10)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-take-while', 'number-theory.composite?'],\n },\n 'composite?': {\n category: 'number-theory',\n description: 'Determines if a number is composite.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(4)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(5)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(11)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.prime?', 'number-theory.prime-factors', 'number-theory.composite-take-while'],\n },\n 'deficient-seq': {\n category: 'number-theory',\n description: 'Generates the deficient numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(1)',\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(5)',\n ],\n seeAlso: ['number-theory.deficient-nth', 'number-theory.deficient-take-while', 'number-theory.deficient?', 'number-theory.abundant-seq', 'number-theory.perfect-seq'],\n },\n 'deficient-take-while': {\n category: 'number-theory',\n description: 'Generates the deficient numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { deficient-take-while } = import(\"number-theory\");\\ndeficient-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.deficient?'],\n },\n 'deficient-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the deficient numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(5)',\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(12)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-take-while', 'number-theory.deficient?'],\n },\n 'deficient?': {\n category: 'number-theory',\n description: 'Checks if a number is deficient.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(12)',\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(15)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.abundant?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.deficient-take-while'],\n },\n 'factorial-seq': {\n category: 'number-theory',\n description: 'Generates the factorial sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 19 (the maximum length of the pre-calculated factorial numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(1)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(2)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(3)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(4)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(5)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(10)',\n ],\n seeAlso: ['number-theory.factorial-nth', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial-take-while': {\n category: 'number-theory',\n description: 'Generates the factorial sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { factorial-take-while } = import(\"number-theory\");\\nfactorial-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?'],\n },\n 'factorial-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the factorial sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(1)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(2)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(3)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(4)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(5)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(10)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial?': {\n category: 'number-theory',\n description: 'Checks if a number is in the factorial sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(1)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(2)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(4)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(5)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(6)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(7)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(8)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(9)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3628800)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial', 'number-theory.factorial-take-while'],\n },\n 'fibonacci-seq': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 79 (the maximum length of the pre-calculated Fibonacci numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(1)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(2)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq()',\n ],\n seeAlso: ['number-theory.fibonacci-nth', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?', 'number-theory.lucas-seq', 'number-theory.tribonacci-seq', 'number-theory.pell-seq', 'number-theory.padovan-seq'],\n },\n 'fibonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-take-while } = import(\"number-theory\");\\nfibonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.fibonacci?'],\n },\n 'fibonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the fibonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(5)',\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(50)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?'],\n },\n 'fibonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the fibonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(0)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(1)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(2)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(3)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(4)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(5)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(6)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(7)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(8)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(9)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.lucas?', 'number-theory.fibonacci-take-while', 'number-theory.tribonacci?', 'number-theory.padovan?', 'number-theory.pell?'],\n },\n 'geometric-seq': {\n category: 'number-theory',\n description: 'Generates the geometric sequence for a given $start, $ratio, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(3, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(2, 3, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.geometric-nth', 'number-theory.geometric-take-while', 'number-theory.geometric?', 'number-theory.arithmetic-seq'],\n },\n 'geometric-take-while': {\n category: 'number-theory',\n description: 'Generates the geometric sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { geometric-take-while } = import(\"number-theory\");\\ngeometric-take-while(1, 1.5, -> $ < 10)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.geometric?'],\n },\n 'geometric-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the geometric sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(3, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(2, 3, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 1.5, 4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-take-while', 'number-theory.geometric?'],\n },\n 'geometric?': {\n category: 'number-theory',\n description: 'Checks if a number is in the geometric sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'number',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 2, 1)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(2, 3, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(3, 2, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, 2.25)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, -4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.arithmetic?', 'number-theory.geometric-take-while'],\n },\n 'golomb-seq': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(5)',\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(20)',\n ],\n seeAlso: ['number-theory.golomb-nth', 'number-theory.golomb-take-while', 'number-theory.golomb?', 'number-theory.recaman-seq'],\n },\n 'golomb-take-while': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { golomb-take-while } = import(\"number-theory\");\\ngolomb-take-while(-> $ <= 10)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb?'],\n },\n 'golomb-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Golomb sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(5)',\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(1000)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-take-while', 'number-theory.golomb?'],\n },\n 'golomb?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Golomb sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(1)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(2)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(3345)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(67867864)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb-take-while'],\n },\n 'happy-seq': {\n category: 'number-theory',\n description: 'Generates the happy sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 20 (the maximum length of the pre-calculated happy numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(1)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(2)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(20)',\n ],\n seeAlso: ['number-theory.happy-nth', 'number-theory.happy-take-while', 'number-theory.happy?', 'number-theory.lucky-seq'],\n },\n 'happy-take-while': {\n category: 'number-theory',\n description: 'Generates the happy sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { happy-take-while } = import(\"number-theory\");\\nhappy-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy?'],\n },\n 'happy-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the happy sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the happy number to return.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(1)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(2)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(20)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-take-while', 'number-theory.happy?'],\n },\n 'happy?': {\n category: 'number-theory',\n description: 'Determines if a number is a happy number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy? } = import(\"number-theory\");\\nhappy?(1)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(2)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy-take-while'],\n },\n 'juggler-seq': {\n category: 'number-theory',\n description: 'Generates the Juggler sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the Juggler sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(3)',\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(5)',\n ],\n seeAlso: ['number-theory.collatz-seq'],\n },\n 'look-and-say-seq': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence up to a specified length.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-seq } = import(\"number-theory\");\\nlook-and-say-seq(5)',\n ],\n seeAlso: ['number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say-take-while': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence while a condition is met.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes a string and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while((term, index) -> count(term) < 10)',\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while(-> $2 <= 10)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say?'],\n },\n 'look-and-say-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Look-and-Say sequence.',\n returns: {\n type: 'string',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-nth } = import(\"number-theory\");\\nlook-and-say-nth(5)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say?': {\n category: 'number-theory',\n description: 'Checks if a string is a valid Look-and-Say term.',\n returns: {\n type: 'boolean',\n },\n args: {\n term: {\n type: 'string',\n description: 'The term to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'term',\n ],\n },\n ],\n examples: [\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"111221\")',\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"123\")',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while'],\n },\n 'lucas-seq': {\n category: 'number-theory',\n description: 'Generates the lucas sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 77 (the maximum length of the pre-calculated Lucas numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(1)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(2)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq()',\n ],\n seeAlso: ['number-theory.lucas-nth', 'number-theory.lucas-take-while', 'number-theory.lucas?', 'number-theory.fibonacci-seq'],\n },\n 'lucas-take-while': {\n category: 'number-theory',\n description: 'Generates the lucas sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucas-take-while } = import(\"number-theory\");\\nlucas-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.lucas?'],\n },\n 'lucas-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucas sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(1)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(2)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-take-while', 'number-theory.lucas?'],\n },\n 'lucas?': {\n category: 'number-theory',\n description: 'Determines if a number is in the lucas sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(1)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(2)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.fibonacci?', 'number-theory.lucas-take-while'],\n },\n 'lucky-seq': {\n category: 'number-theory',\n description: 'Generates the lucky sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(1)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(2)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(20)',\n ],\n seeAlso: ['number-theory.lucky-nth', 'number-theory.lucky-take-while', 'number-theory.lucky?', 'number-theory.happy-seq', 'number-theory.prime-seq'],\n },\n 'lucky-take-while': {\n category: 'number-theory',\n description: 'Generates the lucky sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucky-take-while } = import(\"number-theory\");\\nlucky-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.lucky?'],\n },\n 'lucky-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucky sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The position in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(1)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(2)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(20)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-take-while', 'number-theory.lucky?'],\n },\n 'lucky?': {\n category: 'number-theory',\n description: 'Checks if a number is a lucky number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(4)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(7)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(33)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.prime?', 'number-theory.lucky-take-while'],\n },\n 'mersenne-seq': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 9 (the maximum length of the pre-calculated mersenne numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(1)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(5)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq()',\n ],\n seeAlso: ['number-theory.mersenne-nth', 'number-theory.mersenne-take-while', 'number-theory.mersenne?', 'number-theory.prime-seq'],\n },\n 'mersenne-take-while': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { mersenne-take-while } = import(\"number-theory\");\\nmersenne-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.mersenne?'],\n },\n 'mersenne-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Mersenne sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(1)',\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(5)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-take-while', 'number-theory.mersenne?'],\n },\n 'mersenne?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Mersenne sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(3)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(4)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(7)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.prime?', 'number-theory.mersenne-take-while'],\n },\n 'padovan-seq': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(5)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(10)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(20)',\n ],\n seeAlso: ['number-theory.padovan-nth', 'number-theory.padovan-take-while', 'number-theory.padovan?', 'number-theory.fibonacci-seq'],\n },\n 'padovan-take-while': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { padovan-take-while } = import(\"number-theory\");\\npadovan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.padovan?'],\n },\n 'padovan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Padovan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(5)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(10)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(20)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-take-while', 'number-theory.padovan?'],\n },\n 'padovan?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Padovan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(1)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(265)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(6)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.fibonacci?', 'number-theory.padovan-take-while'],\n },\n 'partition-seq': {\n category: 'number-theory',\n description: 'Generates the partition numbers up to a specified length. If no length is provided, it defaults to 299 (the maximum length of the pre-calculated partition numbers).',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(1)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(10)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq()',\n ],\n seeAlso: ['number-theory.partition-nth', 'number-theory.partition-take-while', 'number-theory.partition?', 'number-theory.partitions', 'number-theory.count-partitions'],\n },\n 'partition-take-while': {\n category: 'number-theory',\n description: 'Generates the partition numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { partition-take-while } = import(\"number-theory\");\\npartition-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partition?'],\n },\n 'partition-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the partition numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the partition number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(1)',\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-take-while', 'number-theory.partition?'],\n },\n 'partition?': {\n category: 'number-theory',\n description: 'Checks if a number is in the partition numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition? } = import(\"number-theory\");\\npartition?(0)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(1)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(2)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(3)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(4)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partitions', 'number-theory.partition-take-while'],\n },\n 'pell-seq': {\n category: 'number-theory',\n description: 'Generates the Pell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 42 (the maximum length of the pre-calculated Pell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(5)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(10)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq()',\n ],\n seeAlso: ['number-theory.pell-nth', 'number-theory.pell-take-while', 'number-theory.pell?', 'number-theory.fibonacci-seq'],\n },\n 'pell-take-while': {\n category: 'number-theory',\n description: 'Generates the Pell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { pell-take-while } = import(\"number-theory\");\\npell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.pell?'],\n },\n 'pell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Pell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(5)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(10)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(20)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-take-while', 'number-theory.pell?'],\n },\n 'pell?': {\n category: 'number-theory',\n description: 'Checks if a number is a Pell number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell? } = import(\"number-theory\");\\npell?(1)',\n 'let { pell? } = import(\"number-theory\");\\npell?(470832)',\n 'let { pell? } = import(\"number-theory\");\\npell?(10)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.fibonacci?', 'number-theory.pell-take-while'],\n },\n 'perfect-seq': {\n category: 'number-theory',\n description: 'Generates the perfect numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If no length is provided, it defaults to 7 (the maximum length of the pre-calculated perfect numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(1)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(5)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq()',\n ],\n seeAlso: ['number-theory.perfect-nth', 'number-theory.perfect-take-while', 'number-theory.perfect?', 'number-theory.abundant-seq', 'number-theory.deficient-seq', 'number-theory.amicable?'],\n },\n 'perfect-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-take-while } = import(\"number-theory\");\\nperfect-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.perfect?'],\n },\n 'perfect-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the perfect number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(1)',\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-take-while', 'number-theory.perfect?'],\n },\n 'perfect?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(0)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(1)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(2)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(3)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(4)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(5)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(6)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(7)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(8)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(9)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.sigma', 'number-theory.perfect-take-while', 'number-theory.amicable?', 'number-theory.proper-divisors'],\n },\n 'perfect-square-seq': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(5)',\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-square-nth', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?', 'number-theory.perfect-cube-seq', 'number-theory.perfect-power-seq', 'number-theory.polygonal-seq'],\n },\n 'perfect-square-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-take-while } = import(\"number-theory\");\\nperfect-square-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-square?'],\n },\n 'perfect-square-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect square numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(1)',\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?'],\n },\n 'perfect-square?': {\n category: 'number-theory',\n description: 'Checks if a number is a perfect square.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(16)',\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(20)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-cube?', 'number-theory.perfect-power?', 'number-theory.perfect-square-take-while', 'number-theory.perfect-power', 'number-theory.polygonal?'],\n },\n 'perfect-cube-seq': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(5)',\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-cube-nth', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?', 'number-theory.perfect-square-seq', 'number-theory.perfect-power-seq'],\n },\n 'perfect-cube-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-take-while } = import(\"number-theory\");\\nperfect-cube-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect cube numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(1)',\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect cube numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(7)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(8)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(9)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-square?', 'number-theory.perfect-power?', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-power'],\n },\n 'perfect-power-seq': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(5)',\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-power-nth', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?', 'number-theory.perfect-power', 'number-theory.perfect-square-seq', 'number-theory.perfect-cube-seq'],\n },\n 'perfect-power-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-take-while } = import(\"number-theory\");\\nperfect-power-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power?'],\n },\n 'perfect-power-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect power numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(3)',\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(15)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?'],\n },\n 'perfect-power?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect power numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(7)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(8)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(9)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(10)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power', 'number-theory.perfect-square?', 'number-theory.perfect-cube?', 'number-theory.perfect-power-take-while'],\n },\n 'polygonal-seq': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence for a given number of sides and length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(3, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(4, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(5, 3)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(6, 5)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(100, 10)',\n ],\n seeAlso: ['number-theory.polygonal-nth', 'number-theory.polygonal-take-while', 'number-theory.polygonal?', 'number-theory.perfect-square-seq'],\n },\n 'polygonal-take-while': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { polygonal-take-while } = import(\"number-theory\");\\npolygonal-take-while(15, -> $ < 1000)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.polygonal?'],\n },\n 'polygonal-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the polygonal sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(3, 9)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(4, 5)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(5, 5)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-take-while', 'number-theory.polygonal?'],\n },\n 'polygonal?': {\n category: 'number-theory',\n description: 'Checks if a number is in the polygonal sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 10)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 9)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 10000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 1000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(6, 45)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.perfect-square?', 'number-theory.polygonal-take-while'],\n },\n 'prime-seq': {\n category: 'number-theory',\n description: 'Generates the prime sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(1)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(2)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(10)',\n ],\n seeAlso: ['number-theory.prime-nth', 'number-theory.prime-take-while', 'number-theory.prime?', 'number-theory.composite-seq', 'number-theory.mersenne-seq', 'number-theory.lucky-seq'],\n },\n 'prime-take-while': {\n category: 'number-theory',\n description: 'Generates the prime sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { prime-take-while } = import(\"number-theory\");\\nprime-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.prime?'],\n },\n 'prime-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the prime sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(1)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(2)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(10)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-take-while', 'number-theory.prime?'],\n },\n 'prime?': {\n category: 'number-theory',\n description: 'Determines if a number is prime.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime? } = import(\"number-theory\");\\nprime?(1)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(2)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(3)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(4)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(997)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(1001)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.composite?', 'number-theory.prime-factors', 'number-theory.mersenne?', 'number-theory.prime-take-while', 'number-theory.lucky?'],\n },\n 'recaman-seq': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(5)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(10)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(20)',\n ],\n seeAlso: ['number-theory.recaman-nth', 'number-theory.recaman-take-while', 'number-theory.recaman?', 'number-theory.golomb-seq'],\n },\n 'recaman-take-while': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { recaman-take-while } = import(\"number-theory\");\\nrecaman-take-while(-> $ < 10)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman?'],\n },\n 'recaman-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Recaman sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(5)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(10)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-take-while', 'number-theory.recaman?'],\n },\n 'recaman?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Recaman sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(5)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(10)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman-take-while'],\n },\n 'sylvester-seq': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 6 (the maximum length of the pre-calculated Sylvester numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq(5)',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n ],\n seeAlso: ['number-theory.sylvester-nth', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester-take-while': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { sylvester-take-while } = import(\"number-theory\");\\nsylvester-take-while(-> $ < 100000)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester?'],\n },\n 'sylvester-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Sylvester sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(1)',\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(5)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Sylvester sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(2)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(3)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(6)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester-take-while'],\n },\n 'thue-morse-seq': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(5)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(10)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(20)',\n ],\n seeAlso: ['number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse-take-while': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-take-while } = import(\"number-theory\");\\nthue-morse-take-while(-> $2 < 10)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse?'],\n },\n 'thue-morse-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Thue-Morse sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(5)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(10)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(20)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the Thue-Morse sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(1)',\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(2)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while'],\n },\n 'tribonacci-seq': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(1)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(2)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(10)',\n ],\n seeAlso: ['number-theory.tribonacci-nth', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?', 'number-theory.fibonacci-seq'],\n },\n 'tribonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-take-while } = import(\"number-theory\");\\ntribonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.tribonacci?'],\n },\n 'tribonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the tribonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(1)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(2)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?'],\n },\n 'tribonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the tribonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(0)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(1)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(2)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(3)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(4)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(5)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(6)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(7)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(8)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(9)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.fibonacci?', 'number-theory.tribonacci-take-while'],\n },\n 'count-combinations': {\n category: 'number-theory',\n description: 'Calculates the number of combinations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(5, 3)',\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(10, 2)',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.count-permutations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-second', 'number-theory.count-partitions', 'number-theory.count-power-set'],\n },\n 'combinations': {\n category: 'number-theory',\n description: 'Generates all possible combinations of a specified size from a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate combinations from.',\n },\n n: {\n type: 'integer',\n description: 'The size of each combination.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([\"a\", \"b\", \"c\"], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 0)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 1)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 3)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.permutations', 'number-theory.power-set', 'number-theory.cartesian-product', 'number-theory.partitions'],\n },\n 'count-derangements': {\n category: 'number-theory',\n description: 'Calculates the number of derangements (permutations where no element appears in its original position) of n items.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The total number of items.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(4)',\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(5)',\n ],\n seeAlso: ['number-theory.derangements', 'number-theory.count-permutations', 'number-theory.factorial'],\n },\n 'derangements': {\n category: 'number-theory',\n description: 'Generates all derangements (permutations where no element appears in its original position) of a set.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate derangements from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { derangements } = import(\"number-theory\");\\nderangements([1, 2, 3, 4])',\n 'let { derangements } = import(\"number-theory\");\\nderangements([\"a\", \"b\", \"c\"])',\n ],\n seeAlso: ['number-theory.count-derangements', 'number-theory.permutations'],\n },\n 'divisors': {\n category: 'number-theory',\n description: 'Returns the divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { divisors } = import(\"number-theory\");\\ndivisors(12)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(100)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(37)',\n ],\n seeAlso: ['number-theory.count-divisors', 'number-theory.proper-divisors', 'number-theory.sigma', 'number-theory.prime-factors', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.count-proper-divisors'],\n },\n 'count-divisors': {\n category: 'number-theory',\n description: 'Returns the number of divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(12)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(100)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(37)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.count-proper-divisors', 'number-theory.sigma'],\n },\n 'proper-divisors': {\n category: 'number-theory',\n description: 'Returns the proper divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(12)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(100)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(37)',\n ],\n seeAlso: ['number-theory.count-proper-divisors', 'number-theory.divisors', 'number-theory.amicable?', 'number-theory.perfect?'],\n },\n 'count-proper-divisors': {\n category: 'number-theory',\n description: 'Returns the number of proper divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(12)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(100)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(37)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.count-divisors', 'number-theory.divisors'],\n },\n 'factorial': {\n category: 'number-theory',\n description: 'Calculates the factorial of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the factorial for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial } = import(\"number-theory\");\\nfactorial(5)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(0)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(10)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(20)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?', 'number-theory.count-combinations', 'number-theory.count-permutations', 'number-theory.multinomial', 'number-theory.count-derangements'],\n },\n 'partitions': {\n category: 'number-theory',\n description: 'Generates all partitions of a number.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to partition.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partitions } = import(\"number-theory\");\\npartitions(4)',\n 'let { partitions } = import(\"number-theory\");\\npartitions(8)',\n ],\n seeAlso: ['number-theory.count-partitions', 'number-theory.partition-seq', 'number-theory.combinations', 'number-theory.partition?'],\n },\n 'count-partitions': {\n category: 'number-theory',\n description: 'Returns the number of partitions of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count partitions for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(4)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(8)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(15)',\n ],\n seeAlso: ['number-theory.partitions', 'number-theory.partition-seq', 'number-theory.count-combinations'],\n },\n 'permutations': {\n category: 'number-theory',\n description: 'Generates all permutations of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate permutations from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([\"a\", \"b\", \"c\"])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3, 4])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([])',\n ],\n seeAlso: ['number-theory.count-permutations', 'number-theory.combinations', 'number-theory.derangements', 'number-theory.cartesian-product'],\n },\n 'count-permutations': {\n category: 'number-theory',\n description: 'Returns the number of permutations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(5, 3)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 2)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 10)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 0)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 1)',\n ],\n seeAlso: ['number-theory.permutations', 'number-theory.count-combinations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-first', 'number-theory.count-derangements'],\n },\n 'power-set': {\n category: 'number-theory',\n description: 'Generates the power set of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'any',\n array: true,\n description: 'The input collection to generate the power set from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { power-set } = import(\"number-theory\");\\npower-set([\"a\", \"b\", \"c\"])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1, 2])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([])',\n ],\n seeAlso: ['number-theory.count-power-set', 'number-theory.combinations', 'number-theory.cartesian-product'],\n },\n 'count-power-set': {\n category: 'number-theory',\n description: 'Returns the number of subsets of a set.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the set.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(3)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(5)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(10)',\n ],\n seeAlso: ['number-theory.power-set', 'number-theory.count-combinations'],\n },\n 'prime-factors': {\n category: 'number-theory',\n description: 'Returns the prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to factor.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(12)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(100)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(37)',\n ],\n seeAlso: ['number-theory.count-prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.prime?', 'number-theory.divisors', 'number-theory.euler-totient', 'number-theory.mobius', 'number-theory.composite?', 'number-theory.count-distinct-prime-factors'],\n },\n 'count-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(12)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(100)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.count-distinct-prime-factors'],\n },\n 'distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the distinct prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(12)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(100)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.count-distinct-prime-factors', 'number-theory.count-prime-factors'],\n },\n 'count-distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of distinct prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(12)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(100)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.distinct-prime-factors', 'number-theory.prime-factors', 'number-theory.count-prime-factors'],\n },\n 'coprime?': {\n category: 'number-theory',\n description: 'Checks if two numbers are coprime (i.e., their GCD is 1).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 8)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(37, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(5, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(2, 3)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.euler-totient', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.carmichael-lambda'],\n },\n 'divisible-by?': {\n category: 'number-theory',\n description: 'Checks if a number is divisible by another number.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 4)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(37, 1)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 0)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(5, 0)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.gcd', 'number-theory.coprime?'],\n },\n 'gcd': {\n category: 'number-theory',\n description: 'Calculates the greatest common divisor (GCD) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { gcd } = import(\"number-theory\");\\ngcd(100, 25)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(37, 1)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 0)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 5)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(5, 0)',\n ],\n seeAlso: ['number-theory.lcm', 'number-theory.extended-gcd', 'number-theory.coprime?', 'number-theory.divisible-by?'],\n },\n 'lcm': {\n category: 'number-theory',\n description: 'Calculates the least common multiple (LCM) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { lcm } = import(\"number-theory\");\\nlcm(100, 25)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(37, 1)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(0, 5)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(5, 0)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.divisors', 'number-theory.coprime?'],\n },\n 'multinomial': {\n category: 'number-theory',\n description: 'Calculates the multinomial coefficient from of a list of numbers representing the sizes of each group.',\n returns: {\n type: 'integer',\n },\n args: {\n args: {\n type: 'integer',\n rest: true,\n description: 'The numbers representing the sizes of each group.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'args',\n ],\n },\n ],\n examples: [\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(5, 2, 3)',\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(10, 2, 3, 5)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.factorial', 'number-theory.count-permutations'],\n hideOperatorForm: true,\n },\n 'amicable?': {\n category: 'number-theory',\n description: 'Checks if two numbers are amicable (i.e., the sum of the proper divisors of each number equals the other number).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { amicable? } = import(\"number-theory\");\\namicable?(220, 284)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(1184, 1210)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(2620, 2924)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(5020, 5564)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(6232, 6368)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.perfect-seq'],\n },\n 'euler-totient': {\n category: 'number-theory',\n description: 'Calculates the Euler\\'s totient function (φ(n)) of a number, which counts the integers up to n that are coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the totient for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(1)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(2)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(10)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(20)',\n ],\n seeAlso: ['number-theory.coprime?', 'number-theory.carmichael-lambda', 'number-theory.mobius', 'number-theory.prime-factors', 'number-theory.mertens'],\n },\n 'mobius': {\n category: 'number-theory',\n description: 'Calculates the Möbius function (μ(n)) of a number, which is used in number theory.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Möbius function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mertens', 'number-theory.euler-totient', 'number-theory.prime-factors'],\n },\n 'mertens': {\n category: 'number-theory',\n description: 'Calculates the Mertens function (M(n)) of a number, which is the sum of the Möbius function up to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Mertens function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mobius', 'number-theory.euler-totient'],\n },\n 'sigma': {\n category: 'number-theory',\n description: 'Calculates the sum of divisors function (σ(n)) of a number, which is the sum of all positive divisors of n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the sum of divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sigma } = import(\"number-theory\");\\nsigma(1)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(2)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(3)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(4)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(6)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(12)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(30)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.perfect?', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.amicable?', 'number-theory.count-divisors'],\n },\n 'carmichael-lambda': {\n category: 'number-theory',\n description: 'Calculates the Carmichael function (λ(n)) of a number, which is the smallest positive integer m such that a^m ≡ 1 (mod n) for all integers a coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Carmichael function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(1)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(2)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(3)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(4)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(6)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(12)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(30)',\n ],\n seeAlso: ['number-theory.euler-totient', 'number-theory.mod-exp', 'number-theory.coprime?'],\n },\n 'cartesian-product': {\n category: 'number-theory',\n description: 'Calculates the Cartesian product of two or more sets.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n sets: {\n type: 'array',\n array: true,\n description: 'The input collections to calculate the Cartesian product from.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sets',\n ],\n },\n ],\n examples: [\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"], [true, false])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2, 3], [\"x\", \"y\", \"z\"])',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.power-set', 'number-theory.permutations'],\n },\n 'perfect-power': {\n category: 'number-theory',\n description: 'Returns a tuple of the base and exponent if the number is a perfect power, otherwise returns null.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(1)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(2)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(4)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(8)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(9)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(16)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(19)',\n ],\n seeAlso: ['number-theory.perfect-power?', 'number-theory.perfect-power-seq', 'number-theory.perfect-square?', 'number-theory.perfect-cube?'],\n },\n 'mod-exp': {\n category: 'number-theory',\n description: 'Calculates the modular exponentiation of a base raised to an exponent modulo a modulus.',\n returns: {\n type: 'integer',\n },\n args: {\n base: {\n type: 'integer',\n },\n exponent: {\n type: 'integer',\n },\n modulus: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'base',\n 'exponent',\n 'modulus',\n ],\n },\n ],\n examples: [\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(2, 3, 5)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(3, 4, 7)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(5, 6, 11)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(7, 8, 13)',\n ],\n seeAlso: ['number-theory.mod-inv', 'number-theory.carmichael-lambda', 'number-theory.chinese-remainder'],\n },\n 'mod-inv': {\n category: 'number-theory',\n description: 'Calculates the modular multiplicative inverse of a number modulo another number.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'm',\n ],\n },\n ],\n examples: [\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(3, 11)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(10, 17)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(5, 13)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(7, 19)',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.extended-gcd', 'number-theory.chinese-remainder'],\n },\n 'extended-gcd': {\n category: 'number-theory',\n description: 'Calculates the extended greatest common divisor (GCD) of two numbers, returning the GCD and the coefficients of Bézout\\'s identity.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(30, 12)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(56, 98)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(101, 10)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(17, 13)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.mod-inv', 'number-theory.chinese-remainder'],\n },\n 'chinese-remainder': {\n category: 'number-theory',\n description: 'Solves a system of simultaneous congruences using the Chinese Remainder Theorem.',\n returns: {\n type: 'integer',\n },\n args: {\n remainders: {\n type: 'integer',\n array: true,\n description: 'The remainders of the congruences.',\n },\n moduli: {\n type: 'integer',\n array: true,\n description: 'The moduli of the congruences.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'remainders',\n 'moduli',\n ],\n },\n ],\n examples: [\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([2, 3], [3, 5])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2], [3, 4])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([0, 1], [2, 3])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2, 3], [4, 5, 7])',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.mod-inv', 'number-theory.extended-gcd'],\n },\n 'stirling-first': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the first kind, which count the number of permutations of n elements with k cycles.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of cycles.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(5, 2)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(4, 3)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(6, 1)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(7, 4)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-second', 'number-theory.bell-seq', 'number-theory.count-permutations'],\n },\n 'stirling-second': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the second kind, which count the number of ways to partition n elements into k non-empty subsets.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of subsets.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(5, 2)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(4, 3)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(6, 1)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(7, 4)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-first', 'number-theory.bell-seq', 'number-theory.count-combinations'],\n },\n}\n","export function binomialCoefficient(n: number, k: number): number {\n if (k === 0 || k === n)\n return 1\n\n let result = 1\n for (let i = 0; i < k; i++)\n result *= (n - i) / (i + 1)\n\n return result\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { binomialCoefficient } from './binomialCefficient'\n\n/**\n * Generates all possible combinations of a specified size from a collection.\n * @param collection The input collection to generate combinations from\n * @param size The size of each combination\n * @returns An array of arrays, where each inner array is a combination of the specified size\n */\nfunction combinations<T>(collection: T[], size: number): T[][] {\n // Base case: if size is 1, return each element as its own combination\n if (size === 1) {\n return collection.map(item => [item])\n }\n\n const result: T[][] = []\n\n // Recursive approach to build combinations\n for (let i = 0; i <= collection.length - size; i++) {\n // Take the current element\n const current = collection[i]!\n\n // Get all combinations of size-1 from the rest of the elements\n const subCombinations = combinations(\n collection.slice(i + 1),\n size - 1,\n )\n\n // Add the current element to each sub-combination\n for (const subComb of subCombinations) {\n result.push([current, ...subComb])\n }\n }\n\n return result\n}\n\nexport const combinationsNormalExpressions: BuiltinNormalExpressions = {\n 'combinations': {\n evaluate: ([set, n], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: set.length })\n if (n === 0)\n return [[]]\n return combinations(set, n)\n },\n arity: toFixedArity(2),\n },\n 'count-combinations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return binomialCoefficient(n, k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction getAllDerangements(arr: Arr): Arr[] {\n const n = arr.length\n const result: Arr[] = []\n const used = Array.from({ length: n }, () => false)\n const temp: Arr = Array.from({ length: n })\n\n function generateDerangements(pos: number): void {\n if (pos === n) {\n result.push([...temp])\n return\n }\n\n for (let i = 0; i < n; i++) {\n // Skip if element is already used or would be in its original position\n if (used[i] || i === pos) {\n continue\n }\n\n used[i] = true\n temp[pos] = arr[i]!\n generateDerangements(pos + 1)\n used[i] = false\n }\n }\n\n generateDerangements(0)\n return result\n}\n\nfunction countDerangements(n: number): number {\n if (n === 1)\n return 0\n\n let a = 1 // !0\n let b = 0 // !1\n let result = 0\n\n for (let i = 2; i <= n; i++) {\n result = (i - 1) * (a + b)\n a = b\n b = result\n }\n\n return result\n}\n\nexport const derangementsNormalExpressions: BuiltinNormalExpressions = {\n 'derangements': {\n evaluate: ([set], sourceCodeInfo): Arr => {\n assertArray(set, sourceCodeInfo)\n return getAllDerangements(set)\n },\n arity: toFixedArity(1),\n },\n 'count-derangements': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return countDerangements(n)\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction calcUnsortedDivisors(number: number): number[] {\n const divisors: number[] = []\n for (let i = 1; i <= Math.sqrt(number); i++) {\n if (number % i === 0) {\n divisors.push(i)\n if (i !== number / i) {\n divisors.push(number / i)\n }\n }\n }\n return divisors\n}\n\nexport function getDivisors(n: number): number[] {\n const unsortedDivisors = calcUnsortedDivisors(n)\n const sortedDivisors = unsortedDivisors.sort((a, b) => a - b)\n return sortedDivisors\n}\n\nexport function getProperDivisors(n: number): number[] {\n return getDivisors(n).slice(0, -1) // Exclude the number itself\n}\n\nexport const divisorsNormalExpressions: BuiltinNormalExpressions = {\n 'divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length\n },\n arity: toFixedArity(1),\n },\n 'proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getProperDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length - 1 // Exclude the number itself\n },\n arity: toFixedArity(1),\n },\n}\n","export const factorialNumbers = [\n 1,\n 1,\n 2,\n 6,\n 24,\n 120,\n 720,\n 5040,\n 40320,\n 362880,\n 3628800,\n 39916800,\n 479001600,\n 6227020800,\n 87178291200,\n 1307674368000,\n 20922789888000,\n 355687428096000,\n 6402373705728000,\n]\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialNumbers } from './sequences/factorial'\n\nexport function factorialOf(n: number): number {\n if (n < 0)\n throw new Error('Factorial is not defined for negative numbers')\n\n if (n === 0 || n === 1)\n return 1\n\n if (n <= 18) {\n return factorialNumbers[n]!\n }\n let result = factorialNumbers[18]!\n for (let i = 19; i <= n; i++)\n result *= i\n\n return result\n}\n\nexport const factorialNormalExpressions: BuiltinNormalExpressions = {\n factorial: {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: 170 })\n return factorialOf(n)\n },\n arity: toFixedArity(1),\n },\n}\n","export const partitionNumbers = [\n 1,\n 2,\n 3,\n 5,\n 7,\n 11,\n 15,\n 22,\n 30,\n 42,\n 56,\n 77,\n 101,\n 135,\n 176,\n 231,\n 297,\n 385,\n 490,\n 627,\n 792,\n 1002,\n 1255,\n 1575,\n 1958,\n 2436,\n 3010,\n 3718,\n 4565,\n 5604,\n 6842,\n 8349,\n 10143,\n 12310,\n 14883,\n 17977,\n 21637,\n 26015,\n 31185,\n 37338,\n 44583,\n 53174,\n 63261,\n 75175,\n 89134,\n 105558,\n 124754,\n 147273,\n 173525,\n 204226,\n 239943,\n 281589,\n 329931,\n 386155,\n 451276,\n 526823,\n 614154,\n 715220,\n 831820,\n 966467,\n 1121505,\n 1300156,\n 1505499,\n 1741630,\n 2012558,\n 2323520,\n 2679689,\n 3087735,\n 3554345,\n 4087968,\n 4697205,\n 5392783,\n 6185689,\n 7089500,\n 8118264,\n 9289091,\n 10619863,\n 12132164,\n 13848650,\n 15796476,\n 18004327,\n 20506255,\n 23338469,\n 26543660,\n 30167357,\n 34262962,\n 38887673,\n 44108109,\n 49995925,\n 56634173,\n 64112359,\n 72533807,\n 82010177,\n 92669720,\n 104651419,\n 118114304,\n 133230930,\n 150198136,\n 169229875,\n 190569292,\n 214481126,\n 241265379,\n 271248950,\n 304801365,\n 342325709,\n 384276336,\n 431149389,\n 483502844,\n 541946240,\n 607163746,\n 679903203,\n 761002156,\n 851376628,\n 952050665,\n 1064144451,\n 1188908248,\n 1327710076,\n 1482074143,\n 1653668665,\n 1844349560,\n 2056148051,\n 2291320912,\n 2552338241,\n 2841940500,\n 3163127352,\n 3519222692,\n 3913864295,\n 4351078600,\n 4835271870,\n 5371315400,\n 5964539504,\n 6620830889,\n 7346629512,\n 8149040695,\n 9035836076,\n 10015581680,\n 11097645016,\n 12292341831,\n 13610949895,\n 15065878135,\n 16670689208,\n 18440293320,\n 20390982757,\n 22540654445,\n 24908858009,\n 27517052599,\n 30388671978,\n 33549419497,\n 37027355200,\n 40853235313,\n 45060624582,\n 49686288421,\n 54770336324,\n 60356673280,\n 66493182097,\n 73232243759,\n 80630964769,\n 88751778802,\n 97662728555,\n 107438159466,\n 118159068427,\n 129913904637,\n 142798995930,\n 156919475295,\n 172389800255,\n 189334822579,\n 207890420102,\n 228204732751,\n 250438925115,\n 274768617130,\n 301384802048,\n 330495499613,\n 362326859895,\n 397125074750,\n 435157697830,\n 476715857290,\n 522115831195,\n 571701605655,\n 625846753120,\n 684957390936,\n 749474411781,\n 819876908323,\n 896684817527,\n 980462880430,\n 1071823774337,\n 1171432692373,\n 1280011042268,\n 1398341745571,\n 1527273599625,\n 1667727404093,\n 1820701100652,\n 1987276856363,\n 2168627105469,\n 2366022741845,\n 2580840212973,\n 2814570987591,\n 3068829878530,\n 3345365983698,\n 3646072432125,\n 3972999029388,\n 4328363658647,\n 4714566886083,\n 5134205287973,\n 5590088317495,\n 6085253859260,\n 6622987708040,\n 7206841706490,\n 7840656226137,\n 8528581302375,\n 9275102575355,\n 10085065885767,\n 10963707205259,\n 11916681236278,\n 12950095925895,\n 14070545699287,\n 15285151248481,\n 16601598107914,\n 18028182516671,\n 19573856161145,\n 21248279009367,\n 23061871173849,\n 25025873760111,\n 27152408925615,\n 29454549941750,\n 31946390696157,\n 34643126322519,\n 37561133582570,\n 40718063627362,\n 44132934884255,\n 47826239745920,\n 51820051838712,\n 56138148670947,\n 60806135438329,\n 65851585970275,\n 71304185514919,\n 77195892663512,\n 83561103925871,\n 90436839668817,\n 97862933703585,\n 105882246722733,\n 114540884553038,\n 123888443077259,\n 133978259344888,\n 144867692496445,\n 156618412527946,\n 169296722391554,\n 182973889854026,\n 197726516681672,\n 213636919820625,\n 230793554364681,\n 249291451168559,\n 269232701252579,\n 290726957916112,\n 313891991306665,\n 338854264248680,\n 365749566870782,\n 394723676655357,\n 425933084409356,\n 459545750448675,\n 495741934760846,\n 534715062908609,\n 576672674947168,\n 621837416509615,\n 670448123060170,\n 722760953690372,\n 779050629562167,\n 839611730366814,\n 904760108316360,\n 974834369944625,\n 1050197489931117,\n 1131238503938606,\n 1218374349844333,\n 1312051800816215,\n 1412749565173450,\n 1520980492851175,\n 1637293969337171,\n 1762278433057269,\n 1896564103591584,\n 2040825852575075,\n 2195786311682516,\n 2362219145337711,\n 2540952590045698,\n 2732873183547535,\n 2938929793929555,\n 3160137867148997,\n 3397584011986773,\n 3652430836071053,\n 3925922161489422,\n 4219388528587095,\n 4534253126900886,\n 4872038056472084,\n 5234371069753672,\n 5622992691950605,\n 6039763882095515,\n 6486674127079088,\n 6965850144195831,\n 7479565078510584,\n 8030248384943040,\n 8620496275465025,\n]\n","import { LitsError } from '../../../errors'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { partitionNumbers } from './sequences/partition'\n\nfunction partitions(n: number): number[][] {\n // Base cases\n if (n <= 0)\n return [[]]\n if (n === 1)\n return [[1]]\n\n const result: number[][] = []\n\n // Helper function to generate partitions recursively\n function generatePartitions(remaining: number, max: number, current: number[]): void {\n if (remaining === 0) {\n result.push([...current])\n return\n }\n\n // Try all possible numbers from 1 up to max\n for (let i = Math.min(max, remaining); i >= 1; i--) {\n current.push(i)\n generatePartitions(remaining - i, i, current)\n current.pop()\n }\n }\n\n generatePartitions(n, n, [])\n return result\n}\n\nexport const partitionsNormalExpressions: BuiltinNormalExpressions = {\n 'partitions': {\n evaluate: ([n], sourceCodeInfo): number[][] => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n return partitions(n)\n },\n arity: toFixedArity(1),\n },\n 'count-partitions': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n === 0)\n return 1\n\n if (n > partitionNumbers.length) {\n throw new LitsError(`n is too large. The maximum value is ${partitionNumbers.length - 1}.`, sourceCodeInfo)\n }\n\n return partitionNumbers[n - 1]!\n },\n arity: toFixedArity(1),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialOf } from './factorial'\n\n/**\n * Generates all possible permutations of a collection.\n * @param collection The input collection to generate permutations from\n * @returns An array of arrays, where each inner array is a permutation of the input collection\n */\nfunction permutations<T>(collection: T[]): T[][] {\n // Base case: empty array has one permutation - itself\n if (collection.length === 0) {\n return [[]]\n }\n\n const result: T[][] = []\n\n // For each element in the array\n for (let i = 0; i < collection.length; i++) {\n // Extract the current element\n const current = collection[i]!\n\n // Create a new array without the current element\n const remainingElements = [...collection.slice(0, i), ...collection.slice(i + 1)]\n\n // Generate all permutations of the remaining elements\n const subPermutations = permutations(remainingElements)\n\n // Add the current element to the beginning of each sub-permutation\n for (const subPerm of subPermutations) {\n result.push([current, ...subPerm])\n }\n }\n\n return result\n}\n\nexport const permutationsNormalExpressions: BuiltinNormalExpressions = {\n 'permutations': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return permutations(set)\n },\n arity: toFixedArity(1),\n },\n 'count-permutations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return factorialOf(n) / factorialOf(n - k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction powerSet(set: Arr): Arr[] {\n const result: Arr[] = [[]]\n\n for (const value of set) {\n const newSubsets = result.map(subset => [...subset, value])\n result.push(...newSubsets)\n }\n\n return result\n}\n\nexport const powerSetNormalExpressions: BuiltinNormalExpressions = {\n 'power-set': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return powerSet(set)\n },\n arity: toFixedArity(1),\n },\n 'count-power-set': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n >= 53) {\n // Number.MAX_SAFE_INTEGER is 2^53 - 1\n return Infinity\n }\n\n return 2 ** n\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\n/**\n * Returns the prime factorization of a number as an array of its prime factors.\n * For example, factors(12) returns [2, 2, 3].\n * Special case: factors(1) returns an empty array [].\n *\n * @param n - A positive integer to factorize\n * @returns An array of prime factors in ascending order\n */\nexport function primeFactors(n: number): number[] {\n // Special case: 1 has no prime factors\n if (n === 1) {\n return []\n }\n\n const factors: number[] = []\n let divisor = 2\n\n // Find factors by trial division\n while (n > 1) {\n // If divisor divides n evenly\n if (n % divisor === 0) {\n // Add divisor to the factors list\n factors.push(divisor)\n // Divide n by the found factor\n n /= divisor\n }\n else {\n // Move to the next potential divisor\n divisor++\n }\n }\n\n return factors\n}\n\nexport const primeFactorsNormalExpressions: BuiltinNormalExpressions = {\n 'prime-factors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(number)\n },\n arity: toFixedArity(1),\n },\n 'distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number[] => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return Array.from(distinctFactors)\n },\n arity: toFixedArity(1),\n },\n 'count-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(n).length\n },\n arity: toFixedArity(1),\n },\n 'count-distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return distinctFactors.size\n },\n arity: toFixedArity(1),\n },\n}\n","import { getProperDivisors } from '../divisors'\nimport type { SequenceDefinition } from '.'\n\nfunction isAbundant(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum > num\n}\n\nexport const abundantSequence: SequenceDefinition<'abundant'> = {\n 'abundant-seq': (length) => {\n const abundants = []\n let num = 2\n while (abundants.length < length) {\n if (isAbundant(num)) {\n abundants.push(num)\n }\n num += 1\n }\n return abundants\n },\n 'abundant?': n => isAbundant(n),\n 'abundant-take-while': (takeWhile) => {\n const abundants = []\n for (let i = 2; ; i += 1) {\n if (!isAbundant(i)) {\n continue\n }\n if (!takeWhile(i, abundants.length)) {\n break\n }\n abundants.push(i)\n }\n return abundants\n },\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of an arithmetic sequence.\n * @param start The first term of the sequence\n * @param step The common difference between terms\n * @param n The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInArithmeticSequence(\n start: number,\n step: number,\n n: number,\n): boolean {\n // Special case: If step is 0, n must equal start\n if (step === 0) {\n return approxEqual(n, start)\n }\n\n // Calculate position in sequence\n const position = (n - start) / step\n\n // Position must be non-negative\n if (position < 0) {\n return false\n }\n\n // Find nearest integer position\n const roundedPosition = Math.round(position)\n\n // Calculate the value at that position\n const calculatedValue = start + step * roundedPosition\n\n // Check both if position is close to an integer and if the\n // calculated value is close to the input value\n return approxEqual(position, roundedPosition) && approxEqual(calculatedValue, n)\n}\n\nexport const arithmeticNormalExpressions: SequenceNormalExpressions<'arithmetic'> = {\n 'arithmetic-seq': {\n evaluate: ([start, step, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start + i * step)\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-take-while': {\n evaluate: ([start, step, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const arithmetic = []\n for (let i = 0; ; i += 1) {\n const value = start + i * step\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n arithmetic[i] = value\n }\n return arithmetic\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-nth': {\n evaluate: ([start, step, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start + (n - 1) * step\n },\n arity: toFixedArity(3),\n },\n 'arithmetic?': {\n evaluate: ([start, step, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n\n return isInArithmeticSequence(start, step, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { binomialCoefficient } from '../binomialCefficient'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\nfunction getBernoulliSeq(length: number): number[] {\n const bernoulli = [1]\n for (let n = 1; n < length; n += 1) {\n let sum = 0\n for (let k = 0; k < n; k += 1) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n bernoulli[n] = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n }\n return bernoulli\n}\n\n/**\n * Generates Bernoulli numbers as long as the predicate function returns true\n * @param predicate - Function that takes a Bernoulli number and its index and returns true if generation should continue\n * @returns Array of Bernoulli numbers generated until predicate returns false\n */\nfunction generateBernoulli(\n predicate: (value: number, index: number) => boolean,\n): number[] {\n const batchSize = 100\n // Start with computing the Bernoulli numbers\n const bernoulli: number[] = [1]\n let n = 1\n\n // Continue generating as long as the predicate returns true\n while (true) {\n // Generate a batch of numbers at a time for efficiency\n const targetLength = bernoulli.length + batchSize\n\n for (; n < targetLength; n++) {\n let sum = 0\n for (let k = 0; k < n; k++) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n\n const newValue = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n\n // Check if we should continue\n if (!predicate(newValue, n)) {\n // We're done, return the generated sequence (including the last value)\n return bernoulli\n }\n bernoulli.push(newValue)\n }\n }\n}\n\nexport const bernoulliNormalExpressions: Omit<SequenceNormalExpressions<'bernoulli'>, 'bernoulli?'> = {\n 'bernoulli-seq': {\n evaluate: ([length], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n return getBernoulliSeq(length)\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-nth': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const bernoulli = getBernoulliSeq(n)\n return bernoulli[n - 1]!\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-take-while': {\n evaluate: ([fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertFunctionLike(fn, sourceCodeInfo)\n const bernoulli = generateBernoulli((value, index) => !!(executeFunction)(fn, [value, index], contextStack))\n return bernoulli\n },\n arity: toFixedArity(1),\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport function isPrime(num: number): boolean {\n if (num <= 1) {\n return false\n }\n if (num <= 3) {\n return true\n }\n if (num % 2 === 0 || num % 3 === 0) {\n return false\n }\n\n for (let i = 5; i * i <= num; i += 6) {\n if (num % i === 0 || num % (i + 2) === 0) {\n return false\n }\n }\n return true\n}\n\nexport const primeSequence: SequenceDefinition<'prime'> = {\n 'prime-seq': (length) => {\n const primes = []\n let num = 2\n while (primes.length < length) {\n if (isPrime(num)) {\n primes.push(num)\n }\n num += 1\n }\n return primes\n },\n 'prime?': n => isPrime(n),\n 'prime-take-while': (takeWhile) => {\n const primes = []\n for (let i = 2; ; i += 1) {\n if (!isPrime(i)) {\n continue\n }\n if (!takeWhile(i, primes.length)) {\n break\n }\n primes.push(i)\n }\n return primes\n },\n}\n","import { isPrime } from './prime'\nimport type { SequenceDefinition } from '.'\n\nexport function isComposite(num: number): boolean {\n if (num <= 1) {\n return false\n }\n return !isPrime(num)\n}\n\nexport const compositeSequence: SequenceDefinition<'composite'> = {\n 'composite-seq': (length) => {\n const composites = []\n let num = 2\n while (composites.length < length) {\n if (isComposite(num)) {\n composites.push(num)\n }\n num += 1\n }\n return composites\n },\n 'composite?': n => isComposite(n),\n 'composite-take-while': (takeWhile) => {\n const composites = []\n for (let i = 4; ; i += 1) {\n if (!isComposite(i)) {\n continue\n }\n if (!takeWhile(i, composites.length)) {\n break\n }\n composites.push(i)\n }\n return composites\n },\n}\n","import { getProperDivisors } from '../divisors'\nimport type { SequenceDefinition } from '.'\n\nfunction isDeficient(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum < num\n}\n\nexport const deficientSequence: SequenceDefinition<'deficient'> = {\n 'deficient-seq': (length) => {\n const deficients = []\n let num = 1\n while (deficients.length < length) {\n if (isDeficient(num)) {\n deficients.push(num)\n }\n num += 1\n }\n return deficients\n },\n 'deficient?': n => isDeficient(n),\n 'deficient-take-while': (takeWhile) => {\n const deficients = []\n for (let i = 1; ; i += 1) {\n if (!isDeficient(i)) {\n continue\n }\n if (!takeWhile(i, deficients.length)) {\n break\n }\n deficients.push(i)\n }\n return deficients\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of a geometric sequence.\n * @param initialTerm The first term of the sequence (a)\n * @param ratio The common ratio of the sequence (r)\n * @param number The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInGeometricSequence(\n initialTerm: number,\n ratio: number,\n number: number,\n): boolean {\n // Handle special cases\n if (approxEqual(initialTerm, 0)) {\n return approxEqual(number, 0)\n }\n if (approxEqual(ratio, 1)) {\n return approxEqual(number, initialTerm)\n }\n if (approxEqual(ratio, 0)) {\n return approxEqual(number, 0) || approxEqual(number, initialTerm)\n }\n\n // Check if the number is exactly the initial term\n if (approxEqual(number, initialTerm)) {\n return true\n }\n\n // Special case for ratio = -1 (alternating sequence)\n if (approxEqual(ratio, -1)) {\n // In an alternating sequence with ratio -1, the terms are just initialTerm and -initialTerm\n return approxEqual(number, initialTerm) || approxEqual(number, -initialTerm)\n }\n\n // For negative ratios, we need special handling\n if (ratio < 0) {\n // Calculate log using absolute values\n const logResult = Math.log(Math.abs(number / initialTerm)) / Math.log(Math.abs(ratio))\n\n // Check if logResult is very close to an integer\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // For negative ratios, alternating terms have alternating signs\n // Check if sign matches what we expect based on the power\n const expectedSign = roundedLogResult % 2 === 0\n ? Math.sign(initialTerm)\n : Math.sign(initialTerm) * Math.sign(ratio)\n\n return Math.sign(number) === expectedSign\n }\n\n // For positive ratios\n\n // Quick check based on sequence direction\n if ((ratio > 1 && number < initialTerm) || (ratio < 1 && number > initialTerm)) {\n return false\n }\n\n // Calculate n in: number = initialTerm * (ratio^n)\n const logResult = Math.log(number / initialTerm) / Math.log(ratio)\n\n // Check if logResult is very close to an integer and non-negative\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // Verify calculated value matches the number exactly\n const calculatedValue = initialTerm * ratio ** roundedLogResult\n\n return approxEqual(calculatedValue, number)\n}\nexport const geometricNormalExpressions: SequenceNormalExpressions<'geometric'> = {\n 'geometric-seq': {\n evaluate: ([start, ratio, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start * ratio ** i)\n },\n arity: toFixedArity(3),\n },\n 'geometric-take-while': {\n evaluate: ([start, ratio, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const geometric = []\n for (let i = 0; ; i += 1) {\n const value = start * ratio ** i\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n geometric[i] = value\n }\n return geometric\n },\n arity: toFixedArity(3),\n },\n 'geometric-nth': {\n evaluate: ([start, ratio, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start * ratio ** (n - 1)\n },\n arity: toFixedArity(3),\n },\n 'geometric?': {\n evaluate: ([start, ratio, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n\n return isInGeometricSequence(start, ratio, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import type { SequenceDefinition } from '.'\n\nfunction getGolombSeq(n: number): number[] {\n const golomb = [0, 1]\n for (let i = 2; i <= n; i += 1) {\n golomb.push(1 + golomb[i - golomb[golomb[i - 1]!]!]!)\n }\n return golomb.slice(1)\n}\n\nfunction generateGolombSeq(pred: (golombNumber: number, index: number) => boolean): number[] {\n if (!pred(1, 0)) {\n return []\n }\n const golomb = [0, 1]\n for (let i = 2; ; i++) {\n const golombNumber = 1 + golomb[i - golomb[golomb[i - 1]!]!]!\n if (!pred(golombNumber, i - 1)) {\n break\n }\n golomb.push(golombNumber)\n }\n return golomb.slice(1)\n}\n\nexport const golombSequence: SequenceDefinition<'golomb'> = {\n 'golomb-seq': length => getGolombSeq(length),\n 'golomb?': () => true,\n 'golomb-take-while': takeWhile => generateGolombSeq(takeWhile),\n}\n","import type { SequenceDefinition } from '.'\n\nfunction isHappyNumber(n: number): boolean {\n // A happy number is defined by the following process:\n // 1. Starting with any positive integer, replace the number by the sum of the squares of its digits\n // 2. Repeat until either:\n // - The number equals 1 (in which case it's a happy number)\n // - It enters a cycle that doesn't include 1 (in which case it's not a happy number)\n\n if (n <= 0)\n return false\n\n // Use a set to detect cycles\n const seen = new Set()\n\n // Continue until we either reach 1 or detect a cycle\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = getSumOfSquaredDigits(n)\n }\n\n // If we reached 1, it's a happy number\n return n === 1\n}\n\nfunction getSumOfSquaredDigits(n: number): number {\n let sum = 0\n\n while (n > 0) {\n const digit = n % 10\n sum += digit * digit\n n = Math.floor(n / 10)\n }\n\n return sum\n}\n\nexport const happySequence: SequenceDefinition<'happy'> = {\n 'happy-seq': (length) => {\n const happyNumbers: number[] = []\n for (let i = 1; happyNumbers.length < length; i++) {\n let n = i\n const seen = new Set<number>()\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = String(n)\n .split('')\n .reduce((sum, digit) => sum + Number(digit) ** 2, 0)\n }\n if (n === 1)\n happyNumbers.push(i)\n }\n return happyNumbers\n },\n 'happy?': n => isHappyNumber(n),\n 'happy-take-while': (takeWhile) => {\n const happyNumbers = []\n\n for (let i = 1; ; i++) {\n let n = i\n const seen = new Set<number>()\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = String(n)\n .split('')\n .reduce((sum, digit) => sum + Number(digit) ** 2, 0)\n }\n if (n === 1) {\n if (!takeWhile(i, happyNumbers.length)) {\n break\n }\n happyNumbers.push(i)\n }\n }\n\n return happyNumbers\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const jugglerSequence: Omit<SequenceDefinition<'juggler'>, 'juggler-nth' | 'juggler-take-while' | 'juggler?'> = {\n 'juggler-seq': (start) => {\n let next = start\n const juggler = [next]\n\n while (next > 1) {\n next = next % 2 === 0\n ? Math.floor(Math.sqrt(next))\n : Math.floor(next ** (3 / 2))\n juggler.push(next)\n }\n return juggler\n },\n 'noNth': true,\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is part of the Look-and-Say sequence.\n *\n * The Look-and-Say sequence starts with \"1\" and each subsequent term describes\n * the previous term by counting consecutive digits. For example:\n * 1, 11, 21, 1211, 111221, 312211, 13112221, ...\n *\n * @param {string|number} target - The number to check (can be a string or number)\n * @returns {boolean} - Whether the target is in the sequence\n */\nfunction isLookAndSay(target: string): boolean {\n // The first term of the sequence\n let current = '1'\n\n // Check if the first term matches\n if (current === target) {\n return true\n }\n\n // Generate terms and check against the target\n while (true) {\n current = getNextLookAndSayTerm(current)\n\n if (current === target) {\n return true\n }\n\n // Optimization: if the current term is longer than the target, and\n // the sequence is strictly increasing in length, the target won't be found\n if (current.length > target.length) {\n return false\n }\n }\n}\n\n/**\n * Generates the next term in the Look-and-Say sequence\n *\n * @param {string} term - The current term\n * @returns {string} - The next term in the sequence\n */\nfunction getNextLookAndSayTerm(term: string): string {\n let result = ''\n let count = 1\n\n for (let i = 0; i < term.length; i++) {\n // If the current digit is the same as the next one, increment count\n if (i + 1 < term.length && term[i] === term[i + 1]) {\n count++\n }\n else {\n // Otherwise, append count and the digit to the result\n result += count.toString() + term[i]\n count = 1\n }\n }\n\n return result\n}\n\nexport const lookAndSaySequence: SequenceDefinition<'look-and-say', string> = {\n 'string': true,\n 'look-and-say-seq': (length) => {\n const lookAndSay = ['1']\n for (let i = 1; i < length; i += 1) {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n lookAndSay[i] = next\n }\n return lookAndSay\n },\n 'look-and-say-take-while': (takeWhile) => {\n if (!takeWhile('1', 0)) {\n return []\n }\n const lookAndSay = ['1']\n for (let i = 1; ; i += 1) {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n if (!takeWhile(next, i)) {\n break\n }\n lookAndSay[i] = next\n }\n return lookAndSay\n },\n 'look-and-say?': n => isLookAndSay(n),\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Generates lucky numbers while the predicate function returns true.\n *\n * @param predicate - Function that tests if we should continue generating numbers.\n * Takes the current lucky number and index as parameters.\n * @returns An array of lucky numbers\n */\nfunction generateLuckyNumbers(\n predicate: (luckyNumber: number, index: number) => boolean,\n): number[] {\n // Start with counting from 1\n const numbers: number[] = []\n for (let i = 1; i <= 2000; i++) {\n numbers.push(i)\n }\n\n // First step: remove all even numbers (keep 1)\n let filteredNumbers: number[] = [1]\n for (let i = 1; i < numbers.length; i++) {\n if (numbers[i]! % 2 !== 0) {\n filteredNumbers.push(numbers[i]!)\n }\n }\n\n const luckyNumbers: number[] = [1] // 1 is always the first lucky number\n let count = 1\n\n // Check if we should continue after the first number\n if (!predicate(1, 0)) {\n return []\n }\n\n // Continue the sieve process\n let index = 1 // Start with the second element (index 1, which is 3)\n\n while (index < filteredNumbers.length) {\n // Get the current lucky number\n const luckyNumber = filteredNumbers[index]!\n\n // Check if we should continue\n if (!predicate(luckyNumber, count)) {\n break\n }\n\n // Add to result\n luckyNumbers.push(luckyNumber)\n count++\n\n // Apply the sieve\n const step = luckyNumber\n const newFiltered: number[] = []\n\n for (let i = 0; i < filteredNumbers.length; i++) {\n if ((i + 1) % step !== 0) { // Keep numbers not at positions divisible by step\n newFiltered.push(filteredNumbers[i]!)\n }\n }\n\n filteredNumbers = newFiltered\n index++\n\n // If we're running low on numbers, extend the sequence\n if (index >= filteredNumbers.length - 5) {\n const lastNum = filteredNumbers[filteredNumbers.length - 1]!\n let next = lastNum + 2\n\n while (filteredNumbers.length < index + 1000) {\n filteredNumbers.push(next)\n next += 2\n }\n }\n }\n\n return luckyNumbers\n}\n\n/**\n * Generates lucky numbers up to a specified length or count\n *\n * Lucky numbers are a subset of integers defined by a specific sieving process:\n * 1. Start with all positive integers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...\n * 2. Keep 1, delete every 2nd number: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, ...\n * 3. The second remaining number is 3, so keep it and delete every 3rd number: 1, 3, 7, 9, 13, 15, 19, ...\n * 4. The third remaining number is 7, so keep it and delete every 7th number\n * 5. Continue this process to get all lucky numbers\n *\n * @param count - The number of lucky numbers to generate\n * @returns An array containing the first 'count' lucky numbers\n */\nfunction getLuckyNumbers(count: number): number[] {\n // Step 1: Start with all odd numbers (we skip the first elimination step since we know\n // the first sieve removes all even numbers)\n const numbers: number[] = []\n let n = 1\n // Generate enough odd numbers to ensure we'll have 'count' lucky numbers after sieving\n // The factor depends on how many numbers we expect to be eliminated\n // For larger counts, we need a higher factor to ensure we have enough numbers\n const factor = count < 100 ? 20 : 30\n const initialSize = count * factor\n\n while (numbers.length < initialSize) {\n numbers.push(n)\n n += 2\n }\n\n // Step 2 and beyond: Apply the lucky number sieve\n let sieveIndex = 1 // Start at index 1 (the second element which is 3)\n\n while (sieveIndex < numbers.length && sieveIndex < count) {\n const sieveValue = numbers[sieveIndex]!\n\n // Remove every sieveValue-th number\n // This is an optimization over creating a new array each time\n let j = 0\n for (let i = 0; i < numbers.length; i++) {\n if ((i + 1) % sieveValue !== 0) {\n numbers[j++] = numbers[i]!\n }\n }\n numbers.length = j // Truncate the array\n\n // Only increment sieveIndex if it's still within the new array bounds\n if (sieveIndex < numbers.length) {\n sieveIndex++\n }\n }\n\n // Return the requested number of lucky numbers\n return numbers.slice(0, count)\n}\n\nexport const luckySequence: SequenceDefinition<'lucky'> = {\n 'lucky-seq': length => getLuckyNumbers(length),\n 'lucky?': n => generateLuckyNumbers(l => l <= n).includes(n),\n 'lucky-take-while': takeWhile => generateLuckyNumbers(takeWhile),\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a Padovan number.\n * Padovan numbers follow the recurrence relation: P(n) = P(n-2) + P(n-3) for n >= 3,\n * with initial values P(0) = P(1) = P(2) = 1.\n *\n * The first few Padovan numbers are:\n * 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, ...\n *\n * @param num - The number to check\n * @returns True if the number is a Padovan number, false otherwise\n */\nfunction isPadovan(num: number): boolean {\n // Padovan numbers are always positive integers\n if (!Number.isInteger(num) || num <= 0) {\n return false\n }\n\n // Special case: The first three Padovan numbers are all 1\n if (num === 1) {\n return true\n }\n\n // Pre-calculated Padovan numbers (for efficient lookup, verified for correctness)\n const padovanNumbers = [\n 1,\n 1,\n 1,\n 2,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 12,\n 16,\n 21,\n 28,\n 37,\n 49,\n 65,\n 86,\n 114,\n 151,\n 200,\n 265,\n 351,\n 465,\n 616,\n 816,\n 1081,\n 1432,\n 1897,\n 2513,\n 3329,\n 4410,\n 5842,\n 7739,\n 10252,\n 13581,\n 17991,\n 23833,\n 31572,\n 41824,\n 55405,\n 73396,\n 97229,\n ]\n\n // Direct lookup for known values\n if (padovanNumbers.includes(num)) {\n return true\n }\n\n // For numbers larger than our pre-calculated list but within JavaScript's safe range\n if (num > padovanNumbers[padovanNumbers.length - 1]! && num <= Number.MAX_SAFE_INTEGER) {\n // Start with the last three values from our known sequence\n let a = padovanNumbers[padovanNumbers.length - 3]!\n let b = padovanNumbers[padovanNumbers.length - 2]!\n let c = padovanNumbers[padovanNumbers.length - 1]!\n let next\n\n // Generate Padovan numbers until we either find a match or exceed the input\n while (c < num) {\n next = a + b\n a = b\n b = c\n c = next\n\n if (c === num) {\n return true\n }\n\n // Check for numeric overflow/precision issues\n if (!Number.isSafeInteger(c)) {\n return false\n }\n }\n }\n\n return false\n}\n\nexport const padovanSequence: SequenceDefinition<'padovan'> = {\n 'padovan-seq': (length) => {\n const padovan = [1, 1, 1]\n for (let i = 3; i < length; i += 1) {\n padovan[i] = padovan[i - 2]! + padovan[i - 3]!\n }\n return padovan.slice(0, length)\n },\n 'padovan?': n => isPadovan(n),\n 'padovan-take-while': (takeWhile) => {\n const padovan: number[] = []\n if (!takeWhile(1, 0)) {\n return padovan\n }\n padovan.push(1)\n if (!takeWhile(1, 1)) {\n return padovan\n }\n padovan.push(1)\n if (!takeWhile(1, 2)) {\n return padovan\n }\n padovan.push(1)\n\n let a = 1\n let b = 1\n let c = 1\n for (let i = 4; ; i += 1) {\n const temp = a + b\n a = b\n b = c\n c = temp\n if (!takeWhile(c, i)) {\n break\n }\n padovan.push(c)\n }\n return padovan\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const perfectCubeSequence: SequenceDefinition<'perfect-cube'> = {\n 'perfect-cube-seq': (length) => {\n const perfectcubes = []\n for (let i = 1; i <= length; i++) {\n perfectcubes.push(i ** 3)\n }\n return perfectcubes\n },\n 'perfect-cube?': n => n > 0 && Number.isInteger(Math.cbrt(n)),\n 'perfect-cube-take-while': (takeWhile) => {\n const perfectcubes = []\n for (let i = 1; ; i++) {\n const value = i ** 3\n if (!takeWhile(value, i)) {\n break\n }\n perfectcubes.push(value)\n }\n return perfectcubes\n },\n}\n","import { approxEqual } from '../../../../utils'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a perfect power and returns the base and exponent if it is.\n * A perfect power is a number that can be expressed as an integer power of another integer.\n *\n * @param n - The number to check\n * @returns [base, exponent] if n is a perfect power, null otherwise\n */\nexport function perfectPower(n: number): [number, number] | null {\n // Handle edge cases\n if (n < 2) {\n if (n === 1) {\n // 1 is 1^k for any k, we return [1, 2] as the simplest representation\n return [1, 2]\n }\n return null // Non positive numbers are not perfect powers\n }\n\n // For each possible exponent k, try to find base b such that b^k = n\n const maxK = Math.floor(Math.log2(n)) + 1\n\n for (let k = 2; k <= maxK; k++) {\n // Calculate the potential base as n^(1/k)\n const b = n ** (1 / k)\n const roundedB = Math.round(b)\n\n if (approxEqual(roundedB ** k, n)) {\n return [roundedB, k]\n }\n }\n\n return null // Not a perfect power\n}\n\nexport const perfectPowerSequence: SequenceDefinition<'perfect-power'> = {\n 'perfect-power-seq': (length) => {\n const perfectPowers: number[] = []\n for (let i = 1; perfectPowers.length < length; i++) {\n if (perfectPower(i)) {\n perfectPowers.push(i)\n }\n }\n return perfectPowers\n },\n 'perfect-power?': n => perfectPower(n) !== null,\n 'perfect-power-take-while': (takeWhile) => {\n const perfectPowers: number[] = []\n for (let i = 1; ; i++) {\n if (perfectPower(i)) {\n if (!takeWhile(i, perfectPowers.length)) {\n break\n }\n perfectPowers.push(i)\n }\n }\n return perfectPowers\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const perfectSquareSequence: SequenceDefinition<'perfect-square'> = {\n 'perfect-square-seq': (length) => {\n const perfectSquares = []\n for (let i = 1; i <= length; i++) {\n perfectSquares.push(i ** 2)\n }\n return perfectSquares\n },\n 'perfect-square?': n => n > 0 && Number.isInteger(Math.sqrt(n)),\n 'perfect-square-take-while': (takeWhile) => {\n const perfectSquares = []\n for (let i = 1; ; i++) {\n const value = i ** 2\n if (!takeWhile(value, i)) {\n break\n }\n perfectSquares.push(value)\n }\n return perfectSquares\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { SequenceNormalExpressions } from '.'\n\nexport const poligonalNormalExpressions: SequenceNormalExpressions<'polygonal'> = {\n 'polygonal-seq': {\n evaluate: ([sides, n], sourceCodeInfo): number[] => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n\n const polygonal = []\n for (let i = 1; i <= n; i += 1) {\n polygonal[i - 1] = (i * i * (sides - 2) - i * (sides - 4)) / 2\n }\n return polygonal\n },\n arity: toFixedArity(2),\n },\n 'polygonal-take-while': {\n evaluate: ([sides, fn], sourceCodeInfo, contextStack, { executeFunction }): number[] => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertFunctionLike(fn, sourceCodeInfo)\n\n const polygonal = []\n for (let i = 1; ; i += 1) {\n const value = (i * i * (sides - 2) - i * (sides - 4)) / 2\n if (!(executeFunction)(fn, [value, i], contextStack, sourceCodeInfo)) {\n break\n }\n polygonal[i - 1] = (i * i * (sides - 2) - i * (sides - 4)) / 2\n }\n return polygonal\n },\n arity: toFixedArity(2),\n },\n 'polygonal-nth': {\n evaluate: ([sides, n], sourceCodeInfo): number => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return (n * n * (sides - 2) - n * (sides - 4)) / 2\n },\n arity: toFixedArity(2),\n },\n 'polygonal?': {\n evaluate: ([sides, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo, { integer: true })\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n\n if (n <= 0) {\n return false\n }\n const a = sides - 2\n const b = sides - 4\n\n const discriminant = 8 * a * n + b * b\n const sqrtPart = Math.sqrt(discriminant)\n\n // Discriminant must yield an integer square root\n if (!Number.isInteger(sqrtPart))\n return false\n\n const numerator = sqrtPart + b\n\n // Numerator must be divisible by 2*a\n if (numerator % (2 * a) !== 0)\n return false\n\n const x = numerator / (2 * a)\n\n // x must be a positive integer\n return Number.isInteger(x) && x > 0\n },\n arity: toFixedArity(2),\n },\n}\n","import type { SequenceDefinition } from '.'\n\n/**\n * Generates the first 'n' terms of the Recamán sequence.\n *\n * @param n - Number of terms to generate\n * @returns Array containing the first n terms of the Recamán sequence\n */\nexport function generateRecamanSequence(n: number): number[] {\n if (n === 1)\n return [0]\n\n const sequence: number[] = [0]\n const seen = new Set<number>([0])\n\n for (let i = 1; i < n; i++) {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n sequence.push(next)\n seen.add(next)\n }\n\n return sequence\n}\n\nexport const recamanSequence: SequenceDefinition<'recaman'> = {\n 'recaman-seq': length => generateRecamanSequence(length),\n 'recaman-take-while': (takeWhile) => {\n if (!takeWhile(0, 0))\n return []\n\n const sequence: number[] = [0]\n const seen = new Set<number>([0])\n\n for (let i = 1; ; i++) {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n if (!takeWhile(next, i))\n break\n\n sequence.push(next)\n seen.add(next)\n }\n\n return sequence\n },\n 'recaman?': () => true,\n}\n","import type { SequenceDefinition } from '.'\n\nexport const thueMorseSequence: SequenceDefinition<'thue-morse'> = {\n 'thue-morse-seq': (length) => {\n const thueMorse = []\n for (let i = 0; i < length; i += 1) {\n thueMorse[i] = countSetBits(i) % 2\n }\n return thueMorse\n },\n 'thue-morse-take-while': (takeWhile) => {\n const thueMorse = []\n for (let i = 0; ; i += 1) {\n const value = countSetBits(i) % 2\n if (!takeWhile(value, i)) {\n break\n }\n thueMorse[i] = value\n }\n return thueMorse\n },\n 'thue-morse?': n => n === 1 || n === 0,\n}\n\nfunction countSetBits(num: number): number {\n let count = 0\n while (num) {\n count += num & 1\n num >>= 1\n }\n return count\n}\n","export const tribonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 4,\n 7,\n 13,\n 24,\n 44,\n 81,\n 149,\n 274,\n 504,\n 927,\n 1705,\n 3136,\n 5768,\n 10609,\n 19513,\n 35890,\n 66012,\n 121415,\n 223317,\n 410744,\n 755476,\n 1389537,\n 2555757,\n 4700770,\n 8646064,\n 15902591,\n 29249425,\n 53798080,\n 98950096,\n 181997601,\n 334745777,\n 615693474,\n 1132436852,\n 2082876103,\n 3831006429,\n 7046319384,\n 12960201916,\n 23837527729,\n 43844049029,\n 80641778674,\n 148323355432,\n 272809183135,\n 501774317241,\n 922906855808,\n 1697490356184,\n 3122171529233,\n 5742568741225,\n 10562230626642,\n 19426970897100,\n 35731770264967,\n 65720971788709,\n 120879712950776,\n 222332455004452,\n 408933139743937,\n 752145307699165,\n 1383410902447554,\n 2544489349890656,\n 4680045560037375,\n 8607945812375585,\n]\n","import { LitsError } from '../../../../errors'\nimport type { SourceCodeInfo } from '../../../../tokenizer/token'\nimport { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { assertString } from '../../../../typeGuards/string'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../../../../builtin/interface'\nimport { abundantSequence } from './abundant'\nimport { arithmeticNormalExpressions } from './arithmetic'\nimport { bellNumbers } from './bell'\nimport { bernoulliNormalExpressions } from './bernoulli'\nimport { catalanNumbers } from './catalan'\nimport { collatzSequence } from './collatz'\nimport { compositeSequence } from './composite'\nimport { deficientSequence } from './deficient'\nimport { factorialNumbers } from './factorial'\nimport { fibonacciNumbers } from './fibonacci'\nimport { geometricNormalExpressions } from './geometric'\nimport { golombSequence } from './golomb'\nimport { happySequence } from './happy'\nimport { jugglerSequence } from './juggler'\nimport { lookAndSaySequence } from './lookAndSay'\nimport { lucasNumbers } from './lucas'\nimport { luckySequence } from './lucky'\nimport { mersenneNumbers } from './mersenne'\nimport { padovanSequence } from './padovan'\nimport { partitionNumbers } from './partition'\nimport { pellNumbers } from './pell'\nimport { perfectNumbers } from './perfect'\nimport { perfectCubeSequence } from './perfectCube'\nimport { perfectPowerSequence } from './perfectPower'\nimport { perfectSquareSequence } from './perfectSquare'\nimport { poligonalNormalExpressions } from './poligonal'\nimport { primeSequence } from './prime'\nimport { recamanSequence } from './recaman'\nimport { sylvesterNumbers } from './sylvester'\nimport { thueMorseSequence } from './thueMorse'\nimport { tribonacciNumbers } from './tribonacci'\n\ntype SeqKey<T extends string> = `${T}-seq`\ntype TakeWhileKey<T extends string> = `${T}-take-while`\ntype NthKey<T extends string> = `${T}-nth`\ntype PredKey<T extends string> = `${T}?`\n\ntype SeqFunction<Type extends number | string> = (length: number, sourceCodeInfo: SourceCodeInfo | undefined) => Type[]\ntype TakeWhileFunction<Type extends number | string> = (pred: (value: Type, index: number) => boolean, sourceCodeInfo: SourceCodeInfo | undefined) => Type[]\ntype PredFunction<Type extends number | string> = (n: Type, sourceCodeInfo: SourceCodeInfo | undefined) => boolean\n\nexport type SequenceKeys<T extends string> = SeqKey<T> | TakeWhileKey<T> | NthKey<T> | PredKey<T>\n\nexport type SequenceDefinition<T extends string, Type extends number | string = number> = {\n [key in Exclude<SequenceKeys<T>, NthKey<T>>]: key extends SeqKey<T>\n ? SeqFunction<Type>\n : key extends TakeWhileKey<T>\n ? TakeWhileFunction<Type>\n : PredFunction<Type>\n} & {\n maxLength?: number\n} & (Type extends string ? {\n string: true\n} : {\n string?: never\n}) & {\n noNth?: true\n}\n\nexport type SequenceNormalExpressions<T extends string, Type extends string | number = number> = {\n [key in SequenceKeys<T>]: key extends SeqKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends TakeWhileKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends NthKey<T>\n ? BuiltinNormalExpression<Type>\n : BuiltinNormalExpression<boolean>\n}\n\nexport const sequenceNormalExpressions: BuiltinNormalExpressions = {}\n\naddSequence(abundantSequence)\naddSequence(collatzSequence)\naddSequence(compositeSequence)\naddSequence(deficientSequence)\naddSequence(golombSequence)\naddSequence(happySequence)\naddSequence(jugglerSequence)\naddSequence(lookAndSaySequence)\naddSequence(luckySequence)\naddSequence(padovanSequence)\naddSequence(perfectSquareSequence)\naddSequence(perfectCubeSequence)\naddSequence(perfectPowerSequence)\naddSequence(primeSequence)\naddSequence(recamanSequence)\naddSequence(thueMorseSequence)\naddNormalExpressions(getFiniteNumberSequence('tribonacci', tribonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('catalan', catalanNumbers))\naddNormalExpressions(getFiniteNumberSequence('factorial', factorialNumbers))\naddNormalExpressions(getFiniteNumberSequence('fibonacci', fibonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('lucas', lucasNumbers))\naddNormalExpressions(getFiniteNumberSequence('mersenne', mersenneNumbers))\naddNormalExpressions(getFiniteNumberSequence('partition', partitionNumbers))\naddNormalExpressions(getFiniteNumberSequence('pell', pellNumbers))\naddNormalExpressions(getFiniteNumberSequence('perfect', perfectNumbers))\naddNormalExpressions(getFiniteNumberSequence('sylvester', sylvesterNumbers))\naddNormalExpressions(getFiniteNumberSequence('bell', bellNumbers))\naddNormalExpressions(arithmeticNormalExpressions)\naddNormalExpressions(bernoulliNormalExpressions)\naddNormalExpressions(geometricNormalExpressions)\naddNormalExpressions(poligonalNormalExpressions)\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n sequenceNormalExpressions[key] = value\n }\n}\n\nfunction getFiniteNumberSequence<T extends string>(name: T, sequence: number[]): SequenceNormalExpressions<T> {\n return {\n [`${name}-seq`]: createSeqNormalExpression(length => sequence.slice(0, length), sequence.length),\n [`${name}-take-while`]: createTakeWhileNormalExpression((takeWhile) => {\n let i = 0\n for (i = 0; ; i += 1) {\n if (i >= sequence.length) {\n break\n }\n if (!takeWhile(sequence[i]!, i)) {\n break\n }\n }\n return sequence.slice(0, i)\n }, sequence.length),\n [`${name}-nth`]: createNthNormalExpression(() => sequence, sequence.length),\n [`${name}?`]: createNumberPredNormalExpression(n => sequence.includes(n)),\n } as unknown as SequenceNormalExpressions<T>\n}\n\nfunction addSequence<Type extends number | string>(sequence: SequenceDefinition<string, Type>) {\n for (const [key, value] of Object.entries(sequence)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n if (key.endsWith('seq')) {\n sequenceNormalExpressions[key] = createSeqNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n if (!sequence.noNth) {\n sequenceNormalExpressions[key.replace(/seq$/, 'nth')] = createNthNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n }\n }\n else if (key.endsWith('take-while')) {\n sequenceNormalExpressions[key] = createTakeWhileNormalExpression(value as TakeWhileFunction<Type>, sequence.maxLength)\n }\n else if (key.endsWith('?')) {\n if (sequence.string) {\n sequenceNormalExpressions[key] = createStringPredNormalExpression(value as PredFunction<string>)\n }\n else {\n sequenceNormalExpressions[key] = createNumberPredNormalExpression(value as PredFunction<number>)\n }\n }\n }\n}\n\nfunction createSeqNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const length = params[0] ?? maxLength\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const result = seqFunction(length, sourceCodeInfo)\n if (typeof result[0] === 'number') {\n /* v8 ignore next 3 */\n if (result.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return result\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createTakeWhileNormalExpression<Type extends number | string>(\n takeWhileFunction: TakeWhileFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = params[0]\n assertFunctionLike(fn, sourceCodeInfo)\n const result = takeWhileFunction((value, index) => !!executeFunction(fn, [value, index], contextStack), sourceCodeInfo)\n if (typeof result[0] === 'number') {\n /* v8 ignore next 3 */\n if (result.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return result\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createNthNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const n = params[0]\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const sequence = seqFunction(n, sourceCodeInfo)\n if (typeof sequence[0] === 'number') {\n /* v8 ignore next 3 */\n if (sequence.some(val => (val as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return sequence[n - 1]!\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createNumberPredNormalExpression(\n predFunction: PredFunction<number>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertNumber(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createStringPredNormalExpression(\n predFunction: PredFunction<string>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertString(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import { LitsError } from '../../../errors'\nimport type { Arr } from '../../../interface'\nimport { assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\nimport { combinationsNormalExpressions } from './combinations'\nimport { derangementsNormalExpressions } from './derangements'\nimport { divisorsNormalExpressions, getDivisors, getProperDivisors } from './divisors'\nimport { factorialNormalExpressions, factorialOf } from './factorial'\nimport { partitionsNormalExpressions } from './partitions'\nimport { permutationsNormalExpressions } from './permutations'\nimport { powerSetNormalExpressions } from './powerSet'\nimport { primeFactors, primeFactorsNormalExpressions } from './primeFactors'\nimport { sequenceNormalExpressions } from './sequences'\nimport { perfectPower } from './sequences/perfectPower'\n\nfunction gcd(a: number, b: number): number {\n while (b !== 0) {\n const temp = b\n b = a % b\n a = temp\n }\n return Math.abs(a)\n}\n\nfunction lcm(a: number, b: number): number {\n return Math.floor((a * b) / gcd(a, b))\n}\n\nfunction mobius(n: number): number {\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n}\n\n/**\n * Efficiently computes (base^exponent) % modulus using the square-and-multiply algorithm\n * Based on the pseudocode algorithm for modular exponentiation\n *\n * @param base - The base number\n * @param exponent - The exponent (must be non-negative)\n * @param modulus - The modulus (must be positive)\n * @returns The result of (base^exponent) % modulus\n */\nfunction modExp(base: number, exponent: number, modulus: number): number {\n // Edge case: modulus is 1\n if (modulus === 1) {\n return 0\n }\n\n // Assert: (modulus - 1) * (modulus - 1) does not overflow base\n // This is a limitation of using regular JavaScript numbers instead of BigInt\n\n // Initialize result\n let result = 1\n\n // Apply modulo to base first\n base = base % modulus\n\n // Square and multiply algorithm\n while (exponent > 0) {\n // If current bit of exponent is 1, multiply result with current base\n if (exponent % 2 === 1) {\n result = (result * base) % modulus\n }\n\n // Shift exponent right (divide by 2)\n exponent = exponent >> 1\n\n // Square the base for next iteration\n base = (base * base) % modulus\n }\n\n return result\n}\n\n/**\n * Extended Euclidean Algorithm\n * Finds gcd(a,b) and coefficients x,y such that ax + by = gcd(a,b)\n */\nfunction extendedGcd(a: number, b: number): [number, number, number] {\n if (b === 0) {\n return [a, 1, 0]\n }\n\n const [g, x, y] = extendedGcd(b, a % b)\n return [g, y, x - Math.floor(a / b) * y]\n}\n\n/**\n * Modular Multiplicative Inverse\n * Finds x such that (a * x) % m = 1\n */\nfunction modInverse(a: number, m: number): number {\n const [g, x] = extendedGcd(a, m)\n\n if (g !== 1) {\n throw new Error(`Modular inverse does not exist (gcd(${a}, ${m}) = ${g})`)\n }\n\n return ((x % m) + m) % m // Ensure positive result\n}\n\n/**\n * Chinese Remainder Theorem\n * Solve system of congruences: x ≡ remainders[i] (mod moduli[i])\n * Returns the smallest positive integer that satisfies all congruences\n */\nfunction chineseRemainder(remainders: number[], moduli: number[]): number {\n // Verify moduli are pairwise coprime\n for (let i = 0; i < moduli.length; i++) {\n for (let j = i + 1; j < moduli.length; j++) {\n const extGcd = extendedGcd(moduli[i]!, moduli[j]!)[0]\n if (extGcd !== 1) {\n throw new Error(`Moduli must be pairwise coprime, but gcd(${moduli[i]}, ${moduli[j]}) = ${extGcd}`)\n }\n }\n }\n\n // Calculate product of all moduli\n const product = moduli.reduce((acc, val) => acc * val, 1)\n\n let sum = 0\n\n for (let i = 0; i < remainders.length; i++) {\n const ai = remainders[i]!\n const ni = moduli[i]!\n const bi = product / ni\n\n // Find modular multiplicative inverse of bi modulo ni\n const inverse = modInverse(bi, ni)\n\n // Add contribution from this congruence\n sum = (sum + ai * bi * inverse) % product\n }\n\n return sum\n}\n\nexport const combinatoricalNormalExpression: BuiltinNormalExpressions = {\n 'coprime?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n return gcd(a, b) === 1\n },\n arity: toFixedArity(2),\n },\n 'divisible-by?': {\n evaluate: ([value, divisor], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n assertNumber(divisor, sourceCodeInfo, { integer: true })\n if (divisor === 0)\n return false\n return value % divisor === 0\n },\n arity: toFixedArity(2),\n },\n 'gcd': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return gcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'lcm': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return lcm(a, b)\n },\n arity: toFixedArity(2),\n },\n\n 'multinomial': {\n evaluate: ([...args], sourceCodeInfo): number => {\n assertVector(args, sourceCodeInfo)\n const sum = args.reduce((acc: number, curr) => {\n assertNumber(curr, sourceCodeInfo, { integer: true, nonNegative: true })\n return acc + curr\n }, 0)\n return factorialOf(sum) / args.reduce((acc, curr) => acc * factorialOf(curr), 1)\n },\n arity: { min: 1 },\n },\n 'amicable?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(b, sourceCodeInfo, { integer: true, positive: true })\n const sumA = getProperDivisors(a).reduce((acc, curr) => acc + curr, 0)\n const sumB = getProperDivisors(b).reduce((acc, curr) => acc + curr, 0)\n return sumA === b && sumB === a && a !== b\n },\n arity: toFixedArity(2),\n },\n 'euler-totient': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n let result = n\n for (let p = 2; p * p <= n; p += 1) {\n if (n % p === 0) {\n while (n % p === 0)\n n /= p\n result -= result / p\n }\n }\n if (n > 1)\n result -= result / n\n return result\n },\n arity: toFixedArity(1),\n },\n 'mobius': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n },\n arity: toFixedArity(1),\n },\n 'mertens': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n let result = 0\n for (let i = 1; i <= n; i++) {\n const mobiusValue = mobius(i)\n result += mobiusValue// * Math.floor(n / i)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'sigma': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return getDivisors(n).reduce((acc, curr) => acc + curr, 0)\n },\n arity: toFixedArity(1),\n },\n 'carmichael-lambda': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1) {\n return 1\n }\n\n // Count occurrences of each prime factor\n const primes = primeFactors(n)\n const factorMap = new Map<number, number>()\n\n for (const prime of primes) {\n factorMap.set(prime, (factorMap.get(prime) || 0) + 1)\n }\n\n const lambdaValues: number[] = []\n\n // Calculate lambda for each prime power\n for (const [p, k] of factorMap.entries()) {\n if (p === 2) {\n if (k === 1) {\n lambdaValues.push(1) // λ(2) = 1\n }\n else if (k === 2) {\n lambdaValues.push(2) // λ(4) = 2\n }\n else {\n lambdaValues.push(2 ** (k - 2)) // λ(2^k) = 2^(k-2) for k >= 3\n }\n }\n else {\n // For odd prime powers p^k: λ(p^k) = (p-1)*p^(k-1)\n lambdaValues.push((p - 1) * p ** (k - 1))\n }\n }\n\n // Find LCM of all lambda values\n return lambdaValues.reduce((acc, val) => lcm(acc, val), 1)\n },\n arity: toFixedArity(1),\n },\n 'cartesian-product': {\n evaluate: (params, sourceCodeInfo): Arr[] => {\n params.forEach((set) => {\n assertArray(set, sourceCodeInfo)\n })\n const sets = params as Arr[]\n return sets.reduce((acc: Arr[], set) => {\n const result: Arr[] = []\n acc.forEach((arr) => {\n set.forEach((value) => {\n result.push([...arr, value])\n })\n })\n return result\n }, [[]])\n },\n arity: { min: 1 },\n },\n 'perfect-power': {\n evaluate: ([n], sourceCodeInfo): [number, number] | null => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const result = perfectPower(n)\n return result || null\n },\n arity: toFixedArity(1),\n },\n 'mod-exp': {\n evaluate: ([base, exponent, modulus], sourceCodeInfo): number => {\n assertNumber(base, sourceCodeInfo, { finite: true })\n assertNumber(exponent, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(modulus, sourceCodeInfo, { integer: true, positive: true })\n\n return modExp(base, exponent, modulus)\n },\n arity: toFixedArity(3),\n },\n 'mod-inv': {\n evaluate: ([a, m], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(m, sourceCodeInfo, { integer: true, positive: true })\n\n try {\n return modInverse(a, m)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'extended-gcd': {\n evaluate: ([a, b], sourceCodeInfo): [number, number, number] => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n\n return extendedGcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'chinese-remainder': {\n evaluate: ([remainders, moduli], sourceCodeInfo): number => {\n assertVector(remainders, sourceCodeInfo)\n assertVector(moduli, sourceCodeInfo)\n if (remainders.length !== moduli.length) {\n throw new LitsError('Remainders and moduli must have the same length.', sourceCodeInfo)\n }\n try {\n return chineseRemainder(remainders, moduli)\n }\n catch (error) {\n throw new LitsError((error as Error).message, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'stirling-first': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n\n // Create a table to store results\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Base case\n dp[0]![0] = 1\n\n // Fill the table using the recurrence relation\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = dp[i - 1]![j - 1]! + (i - 1) * dp[i - 1]![j]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n 'stirling-second': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n if (k === 1)\n return 1 // Only one way to put n objects into one subset\n if (k === n)\n return 1 // Only one way to put n objects into n subsets (one object per subset)\n\n // Create a 2D array for memoization\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Initialize base cases\n dp[0]![0] = 1\n\n // Fill the dp table using the recurrence relation:\n // S(n,k) = k * S(n-1,k) + S(n-1,k-1)\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = j * dp[i - 1]![j]! + dp[i - 1]![j - 1]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n}\n\naddSequences(sequenceNormalExpressions)\naddNormalExpressions(factorialNormalExpressions)\naddNormalExpressions(divisorsNormalExpressions)\naddNormalExpressions(combinationsNormalExpressions)\naddNormalExpressions(permutationsNormalExpressions)\naddNormalExpressions(partitionsNormalExpressions)\naddNormalExpressions(primeFactorsNormalExpressions)\naddNormalExpressions(derangementsNormalExpressions)\naddNormalExpressions(powerSetNormalExpressions)\n\nfunction addSequences(sequences: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(sequences)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (combinatoricalNormalExpression[key])\n combinatoricalNormalExpression[key].docs = docs\n}\n\nexport const numberTheoryModule: LitsModule = {\n name: 'number-theory',\n functions: combinatoricalNormalExpression,\n}\n","import type { SequenceDefinition } from '.'\n\nexport const collatzSequence: Omit<SequenceDefinition<'collatz'>, 'collatz-nth' | 'collatz-take-while' | 'collatz?'> = {\n 'collatz-seq': (start) => {\n let x = start\n const collatz = [x]\n while (x !== 1) {\n if (x % 2 === 0) {\n x /= 2\n }\n else {\n x = 3 * x + 1\n }\n collatz.push(x)\n }\n return collatz\n },\n 'noNth': true,\n}\n","export const catalanNumbers = [\n 1,\n 2,\n 5,\n 14,\n 42,\n 132,\n 429,\n 1430,\n 4862,\n 16796,\n 58786,\n 208012,\n 742900,\n 2674440,\n 9694845,\n 35357670,\n 129644790,\n 477638700,\n 1767263190,\n 6564120420,\n 24466267020,\n 91482563640,\n 343059613650,\n 1289904147324,\n 4861946401452,\n 18367353072152,\n 69533550916004,\n 263747951750360,\n 1002242216651368,\n 3814986502092304,\n]\n","export const fibonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 3,\n 5,\n 8,\n 13,\n 21,\n 34,\n 55,\n 89,\n 144,\n 233,\n 377,\n 610,\n 987,\n 1597,\n 2584,\n 4181,\n 6765,\n 10946,\n 17711,\n 28657,\n 46368,\n 75025,\n 121393,\n 196418,\n 317811,\n 514229,\n 832040,\n 1346269,\n 2178309,\n 3524578,\n 5702887,\n 9227465,\n 14930352,\n 24157817,\n 39088169,\n 63245986,\n 102334155,\n 165580141,\n 267914296,\n 433494437,\n 701408733,\n 1134903170,\n 1836311903,\n 2971215073,\n 4807526976,\n 7778742049,\n 12586269025,\n 20365011074,\n 32951280099,\n 53316291173,\n 86267571272,\n 139583862445,\n 225851433717,\n 365435296162,\n 591286729879,\n 956722026041,\n 1548008755920,\n 2504730781961,\n 4052739537881,\n 6557470319842,\n 10610209857723,\n 17167680177565,\n 27777890035288,\n 44945570212853,\n 72723460248141,\n 117669030460994,\n 190392490709135,\n 308061521170129,\n 498454011879264,\n 806515533049393,\n 1304969544928657,\n 2111485077978050,\n 3416454622906707,\n 5527939700884757,\n 8944394323791464,\n]\n","export const lucasNumbers = [\n 2,\n 1,\n 3,\n 4,\n 7,\n 11,\n 18,\n 29,\n 47,\n 76,\n 123,\n 199,\n 322,\n 521,\n 843,\n 1364,\n 2207,\n 3571,\n 5778,\n 9349,\n 15127,\n 24476,\n 39603,\n 64079,\n 103682,\n 167761,\n 271443,\n 439204,\n 710647,\n 1149851,\n 1860498,\n 3010349,\n 4870847,\n 7881196,\n 12752043,\n 20633239,\n 33385282,\n 54018521,\n 87403803,\n 141422324,\n 228826127,\n 370248451,\n 599074578,\n 969323029,\n 1568397607,\n 2537720636,\n 4106118243,\n 6643838879,\n 10749957122,\n 17393796001,\n 28143753123,\n 45537549124,\n 73681302247,\n 119218851371,\n 192900153618,\n 312119004989,\n 505019158607,\n 817138163596,\n 1322157322203,\n 2139295485799,\n 3461452808002,\n 5600748293801,\n 9062201101803,\n 14662949395604,\n 23725150497407,\n 38388099893011,\n 62113250390418,\n 100501350283429,\n 162614600673847,\n 263115950957276,\n 425730551631123,\n 688846502588399,\n 1114577054219522,\n 1803423556807921,\n 2918000611027443,\n 4721424167835364,\n 7639424778862807,\n]\n","export const mersenneNumbers = [3, 7, 31, 127, 2047, 8191, 131071, 524287, 2147483647]\n","export const pellNumbers = [\n 1,\n 2,\n 5,\n 12,\n 29,\n 70,\n 169,\n 408,\n 985,\n 2378,\n 5741,\n 13860,\n 33461,\n 80782,\n 195025,\n 470832,\n 1136689,\n 2744210,\n 6625109,\n 15994428,\n 38613965,\n 93222358,\n 225058681,\n 543339720,\n 1311738121,\n 3166815962,\n 7645370045,\n 18457556052,\n 44560482149,\n 107578520350,\n 259717522849,\n 627013566048,\n 1513744654945,\n 3654502875938,\n 8822750406821,\n 21300003689580,\n 51422757785981,\n 124145519261542,\n 299713796309065,\n 723573111879672,\n 1746860020068409,\n 4217293152016490,\n]\n","export const perfectNumbers = [6, 28, 496, 8128, 33550336, 8589869056, 137438691328]\n","export const sylvesterNumbers = [\n 2,\n 6,\n 42,\n 1806,\n 3263442,\n 10650056950806,\n]\n","export const bellNumbers = [\n 1,\n 2,\n 5,\n 15,\n 52,\n 203,\n 877,\n 4140,\n 21147,\n 115975,\n 678570,\n 4213597,\n 27644437,\n 190899322,\n 1382958545,\n 10480142147,\n 82864869804,\n 682076806159,\n 5832742205057,\n 51724158235372,\n 474869816156751,\n 4506715738447323,\n]\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","annotatedArrays","WeakSet","vectors","notVectors","assertVector","vector","every","elem","add","isVector","getAssertionError","typeName","assertArray","isObj","regexp","isColl","isSeq","assertFunctionLike","isFunctionLike","toFixedArity","arity","min","moduleDocs","category","description","returns","array","args","variants","argumentNames","examples","seeAlso","takeWhile","n","start","step","ratio","term","sides","a","b","combinations","set","derangements","divisors","factorial","partitions","permutations","gcd","lcm","multinomial","rest","hideOperatorForm","mobius","mertens","sigma","sets","base","exponent","modulus","remainders","moduli","binomialCoefficient","k","result","i","collection","size","map","item","current","subCombinations","slice","subComb","push","combinationsNormalExpressions","evaluate","derangementsNormalExpressions","arr","used","from","temp","generateDerangements","pos","getAllDerangements","countDerangements","calcUnsortedDivisors","number","sqrt","getDivisors","sort","getProperDivisors","divisorsNormalExpressions","factorialNumbers","factorialOf","factorialNormalExpressions","partitionNumbers","partitionsNormalExpressions","generatePartitions","remaining","pop","subPermutations","subPerm","permutationsNormalExpressions","powerSetNormalExpressions","newSubsets","subset","powerSet","Infinity","primeFactors","factors","divisor","primeFactorsNormalExpressions","distinctFactors","isAbundant","num","reduce","acc","curr","abundantSequence","abundants","approxEqual","epsilon","diff","abs","arithmeticNormalExpressions","_","fn","contextStack","executeFunction","arithmetic","roundedPosition","round","calculatedValue","isInArithmeticSequence","getBernoulliSeq","bernoulli","sum","bernoulliNormalExpressions","predicate","targetLength","newValue","generateBernoulli","index","isPrime","primeSequence","primes","isComposite","compositeSequence","composites","isDeficient","deficientSequence","deficients","geometricNormalExpressions","geometric","initialTerm","logResult","log","roundedLogResult","expectedSign","isInGeometricSequence","golombSequence","golomb","getGolombSeq","pred","golombNumber","generateGolombSeq","getSumOfSquaredDigits","digit","floor","happySequence","happyNumbers","seen","split","isHappyNumber","jugglerSequence","next","juggler","noNth","getNextLookAndSayTerm","count","lookAndSaySequence","string","lookAndSay","replace","match","target","isLookAndSay","generateLuckyNumbers","numbers","filteredNumbers","luckyNumbers","luckyNumber","newFiltered","luckySequence","initialSize","sieveIndex","sieveValue","j","getLuckyNumbers","l","includes","padovanSequence","padovan","padovanNumbers","MAX_SAFE_INTEGER","c","isSafeInteger","isPadovan","perfectCubeSequence","perfectcubes","cbrt","perfectPower","maxK","log2","roundedB","perfectPowerSequence","perfectPowers","perfectSquareSequence","perfectSquares","poligonalNormalExpressions","polygonal","discriminant","sqrtPart","numerator","recamanSequence","sequence","generateRecamanSequence","thueMorseSequence","thueMorse","countSetBits","sequenceNormalExpressions","addNormalExpressions","normalExpressions","entries","getFiniteNumberSequence","createSeqNormalExpression","createTakeWhileNormalExpression","createNthNormalExpression","createNumberPredNormalExpression","addSequence","endsWith","maxLength","createStringPredNormalExpression","seqFunction","params","some","takeWhileFunction","val","predFunction","nonEmpty","char","isString","assertString","extendedGcd","g","y","modInverse","m","collatz","combinatoricalNormalExpression","sumA","sumB","p","factorMap","Map","prime","get","lambdaValues","forEach","modExp","error","extGcd","product","ai","ni","bi","chineseRemainder","dp","fill","sequences","addSequences","docs","numberTheoryModule","functions"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI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AAuD,CAClElD,UAAW,CACT+B,SAAU,EAAE3C,GAAI1H,KACd+E,EAAa2C,EAAG1H,EAAgB,CAAEiE,SAAS,EAAMS,aAAa,EAAMI,IAAK,MAClEyG,EAAY7D,IAErBb,MAAOD,EAAa,KC5BX6E,EAAmB,CAC9B,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,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1N,EAAW2N,GAC7B,MAAOH,EAAGlQ,GAAKiQ,GAAYvN,EAAG2N,GAE9B,GAAU,IAANH,EACF,MAAM,IAAI7U,MAAM,uCAAuCqH,MAAM2N,QAAQH,MAGvE,OAASlQ,EAAIqQ,EAAKA,GAAKA,CACzB,CFrCAlB,GAAYzH,GACZyH,GG7EuH,CACrH,cAAgB9M,IACd,IAAIrC,EAAIqC,EACR,MAAMiO,EAAU,CAACtQ,GACjB,KAAa,IAANA,GACDA,EAAI,GAAM,EACZA,GAAK,EAGLA,EAAI,EAAIA,EAAI,EAEdsQ,EAAQzL,KAAK7E,GAEf,OAAOsQ,GAETjF,OAAS,IH+DX8D,GAAY5F,GACZ4F,GAAYzF,IACZyF,GAAY/E,IACZ+E,GAAYtE,IACZsE,GAAYjE,IACZiE,GAAY3D,IACZ2D,GAAY9C,IACZ8C,GAAYtC,IACZsC,GAAYtB,IACZsB,GAAY/B,IACZ+B,GAAYxB,IACZwB,GAAY/F,GACZ+F,GAAYf,IACZe,GAAYZ,IACZI,GAAqBG,GAAwB,aD9FZ,CAC/B,EACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBCgCFH,GAAqBG,GAAwB,UI/Ff,CAC5B,EACA,EACA,EACA,GACA,GACA,IACA,IACA,KACA,KACA,MACA,MACA,OACA,OACA,QACA,QACA,SACA,UACA,UACA,WACA,WACA,YACA,YACA,aACA,cACA,cACA,eACA,eACA,eACA,gBACA,mBJkEFH,GAAqBG,GAAwB,YAAa9I,IAC1D2I,GAAqBG,GAAwB,YKjGb,CAC9B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBLmBFH,GAAqBG,GAAwB,QMlGjB,CAC1B,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBNsBFH,GAAqBG,GAAwB,WOnGd,CAAC,EAAG,EAAG,GAAI,IAAK,KAAM,KAAM,OAAQ,OAAQ,cPoG3EH,GAAqBG,GAAwB,YAAa3I,IAC1DwI,GAAqBG,GAAwB,OQrGlB,CACzB,EACA,EACA,EACA,GACA,GACA,GACA,IACA,IACA,IACA,KACA,KACA,MACA,MACA,MACA,OACA,OACA,QACA,QACA,QACA,SACA,SACA,SACA,UACA,UACA,WACA,WACA,WACA,YACA,YACA,aACA,aACA,aACA,cACA,cACA,cACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,mBR4DFH,GAAqBG,GAAwB,UStGf,CAAC,EAAG,GAAI,IAAK,KAAM,SAAU,WAAY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IpB,GAA+BtS,GACjC,MAAM,IAAI5C,MAAM,0CAA0C4C,KAE5DsS,GAA+BtS,GAAON,CACvC,CACH,CAlBAiU,CAAalD,IACbC,GAAqBzI,GACrByI,GAAqB5I,GACrB4I,GAAqB7J,GACrB6J,GAAqBjI,GACrBiI,GAAqBvI,GACrBuI,GAAqBxH,GACrBwH,GAAqB3J,GACrB2J,GAAqBhI,GAsBrB,IAAK,MAAO1I,EAAK4T,KAAS7V,OAAO6S,QAAQpN,GACnC8O,GAA+BtS,KACjCsS,GAA+BtS,GAAK4T,KAAOA,GAGlC,MAAAC,GAAiC,CAC5C3V,KAAM,gBACN4V,UAAWxB"}
|
|
1
|
+
{"version":3,"file":"number-theory.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/symbols.ts","../../src/utils/debug/debugTools.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/typeGuards/number.ts","../../src/typeGuards/annotatedArrays.ts","../../src/utils/getAssertionError.ts","../../src/typeGuards/array.ts","../../src/typeGuards/litsFunction.ts","../../src/typeGuards/lits.ts","../../src/utils/arity.ts","../../src/builtin/modules/number-theory/docs.ts","../../src/builtin/modules/number-theory/binomialCefficient.ts","../../src/builtin/modules/number-theory/combinations.ts","../../src/builtin/modules/number-theory/derangements.ts","../../src/builtin/modules/number-theory/divisors.ts","../../src/builtin/modules/number-theory/sequences/factorial.ts","../../src/builtin/modules/number-theory/factorial.ts","../../src/builtin/modules/number-theory/sequences/partition.ts","../../src/builtin/modules/number-theory/partitions.ts","../../src/builtin/modules/number-theory/permutations.ts","../../src/builtin/modules/number-theory/powerSet.ts","../../src/builtin/modules/number-theory/primeFactors.ts","../../src/utils/maybePromise.ts","../../src/builtin/modules/number-theory/sequences/abundant.ts","../../src/utils/index.ts","../../src/builtin/modules/number-theory/sequences/arithmetic.ts","../../src/builtin/modules/number-theory/sequences/bernoulli.ts","../../src/builtin/modules/number-theory/sequences/prime.ts","../../src/builtin/modules/number-theory/sequences/composite.ts","../../src/builtin/modules/number-theory/sequences/deficient.ts","../../src/builtin/modules/number-theory/sequences/geometric.ts","../../src/builtin/modules/number-theory/sequences/golomb.ts","../../src/builtin/modules/number-theory/sequences/happy.ts","../../src/builtin/modules/number-theory/sequences/juggler.ts","../../src/builtin/modules/number-theory/sequences/lookAndSay.ts","../../src/builtin/modules/number-theory/sequences/lucky.ts","../../src/builtin/modules/number-theory/sequences/padovan.ts","../../src/builtin/modules/number-theory/sequences/perfectCube.ts","../../src/builtin/modules/number-theory/sequences/perfectPower.ts","../../src/builtin/modules/number-theory/sequences/perfectSquare.ts","../../src/builtin/modules/number-theory/sequences/poligonal.ts","../../src/builtin/modules/number-theory/sequences/recaman.ts","../../src/builtin/modules/number-theory/sequences/thueMorse.ts","../../src/builtin/modules/number-theory/sequences/tribonacci.ts","../../src/builtin/modules/number-theory/sequences/index.ts","../../src/typeGuards/string.ts","../../src/builtin/modules/number-theory/index.ts","../../src/builtin/modules/number-theory/sequences/collatz.ts","../../src/builtin/modules/number-theory/sequences/catalan.ts","../../src/builtin/modules/number-theory/sequences/fibonacci.ts","../../src/builtin/modules/number-theory/sequences/lucas.ts","../../src/builtin/modules/number-theory/sequences/mersenne.ts","../../src/builtin/modules/number-theory/sequences/pell.ts","../../src/builtin/modules/number-theory/sequences/perfect.ts","../../src/builtin/modules/number-theory/sequences/sylvester.ts","../../src/builtin/modules/number-theory/sequences/bell.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getLitsErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class LitsError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getLitsErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, LitsError.prototype)\n this.name = 'LitsError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends LitsError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends LitsError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends LitsError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isLitsError(error: unknown): error is LitsError {\n return error instanceof LitsError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, LitsFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isLitsFunction(func: unknown): func is LitsFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isLitsFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new LitsError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import { LitsError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new LitsError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new LitsError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new LitsError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new LitsError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new LitsError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new LitsError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new LitsError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import { LitsError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from './debug/debugTools'\nimport { getSourceCodeInfo } from './debug/getSourceCodeInfo'\n\nexport function getAssertionError(typeName: string, value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsError {\n return new LitsError(`Expected ${typeName}, got ${valueToString(value)}.`, getSourceCodeInfo(value, sourceCodeInfo))\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\n// isArray not needed, use Array.isArary\nexport function asArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): unknown[] {\n assertArray(value, sourceCodeInfo)\n return value\n}\nexport function assertArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is unknown[] {\n if (!Array.isArray(value))\n throw getAssertionError('array', value, sourceCodeInfo)\n}\n\nexport function isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string')\n}\nexport function asStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertStringArray(value, sourceCodeInfo)\n return value\n}\nexport function assertStringArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isStringArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n\nexport function isCharArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every(v => typeof v === 'string' && v.length === 1)\n}\nexport function asCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): string[] {\n assertCharArray(value, sourceCodeInfo)\n return value\n}\nexport function assertCharArray(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is string[] {\n if (!isCharArray(value))\n throw getAssertionError('array of strings', value, sourceCodeInfo)\n}\n","import type { LitsFunction, NativeJsFunction, NormalBuiltinFunction, UserDefinedFunction } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { FUNCTION_SYMBOL } from '../utils/symbols'\nimport { isUnknownRecord } from '.'\n\nexport function isLitsFunction(value: unknown): value is LitsFunction {\n if (value === null || typeof value !== 'object')\n return false\n\n return !!(value as LitsFunction)[FUNCTION_SYMBOL]\n}\nexport function asLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): LitsFunction {\n assertLitsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertLitsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is LitsFunction {\n if (!isLitsFunction(value))\n throw getAssertionError('LitsFunction', value, sourceCodeInfo)\n}\n\nexport function isUserDefinedFunction(value: unknown): value is UserDefinedFunction {\n return isLitsFunction(value) && value.functionType === 'UserDefined'\n}\nexport function asUserDefinedFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): UserDefinedFunction {\n assertUserDefinedFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertUserDefinedFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is UserDefinedFunction {\n if (!isUserDefinedFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isNativeJsFunction(value: unknown): value is NativeJsFunction {\n return isLitsFunction(value) && value.functionType === 'NativeJsFunction'\n}\nexport function asNativeJsFunction(value: unknown, sourceCodeInfo?: SourceCodeInfo): NativeJsFunction {\n assertNativeJsFunction(value, sourceCodeInfo)\n return value\n}\nexport function assertNativeJsFunction(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is NativeJsFunction {\n if (!isNativeJsFunction(value))\n throw getAssertionError('NativeJsFunction', value, sourceCodeInfo)\n}\n\nexport function isBuiltinFunction(value: unknown): value is NormalBuiltinFunction {\n return isUnknownRecord(value) && value.functionType === 'Builtin'\n}\n","import type { Any, Coll, Obj, Seq } from '../interface'\nimport type { FunctionLike, RegularExpression } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\nimport { REGEXP_SYMBOL } from '../utils/symbols'\nimport { isLitsFunction } from './litsFunction'\n\nexport function isAny(value: unknown): value is Any {\n // TODO weak test\n return value !== undefined\n}\nexport function asAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): Any {\n assertAny(value, sourceCodeInfo)\n return value\n}\nexport function assertAny(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Any {\n if (!isAny(value))\n throw getAssertionError('not undefined', value, sourceCodeInfo)\n}\n\nexport function isSeq(value: unknown): value is Seq {\n return Array.isArray(value) || typeof value === 'string'\n}\nexport function asSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): Seq {\n assertSeq(value, sourceCodeInfo)\n return value\n}\nexport function assertSeq(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Seq {\n if (!isSeq(value))\n throw getAssertionError('string or array', value, sourceCodeInfo)\n}\n\nexport function isObj(value: unknown): value is Obj {\n return !(\n value === null\n || typeof value !== 'object'\n || Array.isArray(value)\n || value instanceof RegExp\n || isLitsFunction(value)\n || isRegularExpression(value)\n )\n}\nexport function asObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): Obj {\n assertObj(value, sourceCodeInfo)\n return value\n}\nexport function assertObj(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Obj {\n if (!isObj(value))\n throw getAssertionError('object', value, sourceCodeInfo)\n}\n\nexport function isColl(value: unknown): value is Coll {\n return isSeq(value) || isObj(value)\n}\nexport function asColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): Coll {\n assertColl(value, sourceCodeInfo)\n return value\n}\nexport function assertColl(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is Coll {\n if (!isColl(value))\n throw getAssertionError('string, array or object', value, sourceCodeInfo)\n}\n\nexport function isRegularExpression(regexp: unknown): regexp is RegularExpression {\n if (regexp === null || typeof regexp !== 'object')\n return false\n\n return !!(regexp as RegularExpression)[REGEXP_SYMBOL]\n}\nexport function asRegularExpression(value: unknown, sourceCodeInfo?: SourceCodeInfo): RegularExpression {\n assertRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is RegularExpression {\n if (!isRegularExpression(value))\n throw getAssertionError('RegularExpression', value, sourceCodeInfo)\n}\n\nexport function isStringOrRegularExpression(value: unknown): value is string | RegularExpression {\n return isRegularExpression(value) || typeof value === 'string'\n}\nexport function asStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): string | RegularExpression {\n assertStringOrRegularExpression(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrRegularExpression(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | RegularExpression {\n if (!isStringOrRegularExpression(value))\n throw getAssertionError('string or RegularExpression', value, sourceCodeInfo)\n}\n\nfunction isFunctionLike(value: unknown): value is FunctionLike {\n if (typeof value === 'number')\n return true\n if (isColl(value))\n return true\n if (isLitsFunction(value))\n return true\n\n return false\n}\nexport function asFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): FunctionLike {\n assertFunctionLike(value, sourceCodeInfo)\n return value\n}\nexport function assertFunctionLike(value: unknown, sourceCodeInfo?: SourceCodeInfo): asserts value is FunctionLike {\n if (!isFunctionLike(value))\n throw getAssertionError('FunctionLike', value, sourceCodeInfo)\n}\n","import type { Arity } from '../builtin/interface'\nimport { LitsError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/lits'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new LitsError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new LitsError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'abundant-seq': {\n category: 'number-theory',\n description: 'Generates the abundant numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(1)',\n 'let { abundant-seq } = import(\"number-theory\");\\nabundant-seq(5)',\n ],\n seeAlso: ['number-theory.abundant-nth', 'number-theory.abundant-take-while', 'number-theory.abundant?', 'number-theory.deficient-seq', 'number-theory.perfect-seq'],\n },\n 'abundant-take-while': {\n category: 'number-theory',\n description: 'Generates the abundant numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { abundant-take-while } = import(\"number-theory\");\\nabundant-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.abundant?'],\n },\n 'abundant-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the abundant numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(1)',\n 'let { abundant-nth } = import(\"number-theory\");\\nabundant-nth(5)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-take-while', 'number-theory.abundant?'],\n },\n 'abundant?': {\n category: 'number-theory',\n description: 'Checks if a number is abundant.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(12)',\n 'let { abundant? } = import(\"number-theory\");\\nabundant?(15)',\n ],\n seeAlso: ['number-theory.abundant-seq', 'number-theory.abundant-nth', 'number-theory.deficient?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.abundant-take-while'],\n },\n 'arithmetic-seq': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence for a given $start, $step, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(3, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(2, 3, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 2, 2)',\n 'let { arithmetic-seq } = import(\"number-theory\");\\narithmetic-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-nth', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?', 'number-theory.geometric-seq'],\n },\n 'arithmetic-take-while': {\n category: 'number-theory',\n description: 'Generates the arithmetic sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-take-while } = import(\"number-theory\");\\narithmetic-take-while(1, 0.25, -> $ < 3)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.arithmetic?'],\n },\n 'arithmetic-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the arithmetic sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(3, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(2, 3, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 2, 2)',\n 'let { arithmetic-nth } = import(\"number-theory\");\\narithmetic-nth(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-take-while', 'number-theory.arithmetic?'],\n },\n 'arithmetic?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the arithmetic sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n step: {\n type: 'number',\n description: 'The common difference of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'step',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(3, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(2, 3, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 2, 2)',\n 'let { arithmetic? } = import(\"number-theory\");\\narithmetic?(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.arithmetic-seq', 'number-theory.arithmetic-nth', 'number-theory.geometric?', 'number-theory.arithmetic-take-while'],\n },\n 'bell-seq': {\n category: 'number-theory',\n description: 'Generates the Bell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 22 (the maximum length of the pre-calculated bell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(5)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq(10)',\n 'let { bell-seq } = import(\"number-theory\");\\nbell-seq()',\n ],\n seeAlso: ['number-theory.bell-nth', 'number-theory.bell-take-while', 'number-theory.bell?', 'number-theory.catalan-seq', 'number-theory.stirling-second', 'number-theory.stirling-first'],\n },\n 'bell-take-while': {\n category: 'number-theory',\n description: 'Generates the Bell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bell-take-while } = import(\"number-theory\");\\nbell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.bell?'],\n },\n 'bell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(5)',\n 'let { bell-nth } = import(\"number-theory\");\\nbell-nth(10)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-take-while', 'number-theory.bell?'],\n },\n 'bell?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Bell sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bell? } = import(\"number-theory\");\\nbell?(1)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644437)',\n 'let { bell? } = import(\"number-theory\");\\nbell?(27644436)',\n ],\n seeAlso: ['number-theory.bell-seq', 'number-theory.bell-nth', 'number-theory.catalan?', 'number-theory.bell-take-while'],\n },\n 'bernoulli-seq': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence up to a specified length.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(5)',\n 'let { bernoulli-seq } = import(\"number-theory\");\\nbernoulli-seq(10)',\n ],\n seeAlso: ['number-theory.bernoulli-nth', 'number-theory.bernoulli-take-while'],\n },\n 'bernoulli-take-while': {\n category: 'number-theory',\n description: 'Generates the Bernoulli sequence while a condition is met.',\n returns: {\n type: 'number',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-take-while } = import(\"number-theory\");\\nbernoulli-take-while(-> abs($) < 100)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-nth'],\n },\n 'bernoulli-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Bernoulli sequence.',\n returns: {\n type: 'number',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(5)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(10)',\n 'let { bernoulli-nth } = import(\"number-theory\");\\nbernoulli-nth(23)',\n ],\n seeAlso: ['number-theory.bernoulli-seq', 'number-theory.bernoulli-take-while'],\n },\n 'catalan-seq': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 30 (the maximum length of the pre-calculated catalan numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(5)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq(10)',\n 'let { catalan-seq } = import(\"number-theory\");\\ncatalan-seq()',\n ],\n seeAlso: ['number-theory.catalan-nth', 'number-theory.catalan-take-while', 'number-theory.catalan?', 'number-theory.bell-seq'],\n },\n 'catalan-take-while': {\n category: 'number-theory',\n description: 'Generates the Catalan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { catalan-take-while } = import(\"number-theory\");\\ncatalan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.catalan?'],\n },\n 'catalan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Catalan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(5)',\n 'let { catalan-nth } = import(\"number-theory\");\\ncatalan-nth(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-take-while', 'number-theory.catalan?'],\n },\n 'catalan?': {\n category: 'number-theory',\n description: 'Determines if a number is in the Catalan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(5)',\n 'let { catalan? } = import(\"number-theory\");\\ncatalan?(10)',\n ],\n seeAlso: ['number-theory.catalan-seq', 'number-theory.catalan-nth', 'number-theory.bell?', 'number-theory.catalan-take-while'],\n },\n 'collatz-seq': {\n category: 'number-theory',\n description: 'Generates the collatz sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the collatz sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(3)',\n 'let { collatz-seq } = import(\"number-theory\");\\ncollatz-seq(11)',\n ],\n seeAlso: ['number-theory.juggler-seq'],\n },\n 'composite-seq': {\n category: 'number-theory',\n description: 'Generates the composite sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(1)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(2)',\n 'let { composite-seq } = import(\"number-theory\");\\ncomposite-seq(10)',\n ],\n seeAlso: ['number-theory.composite-nth', 'number-theory.composite-take-while', 'number-theory.composite?', 'number-theory.prime-seq'],\n },\n 'composite-take-while': {\n category: 'number-theory',\n description: 'Generates the composite sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { composite-take-while } = import(\"number-theory\");\\ncomposite-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.composite?'],\n },\n 'composite-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the composite sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the composite number to retrieve.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(1)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(2)',\n 'let { composite-nth } = import(\"number-theory\");\\ncomposite-nth(10)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-take-while', 'number-theory.composite?'],\n },\n 'composite?': {\n category: 'number-theory',\n description: 'Determines if a number is composite.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(4)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(5)',\n 'let { composite? } = import(\"number-theory\");\\ncomposite?(11)',\n ],\n seeAlso: ['number-theory.composite-seq', 'number-theory.composite-nth', 'number-theory.prime?', 'number-theory.prime-factors', 'number-theory.composite-take-while'],\n },\n 'deficient-seq': {\n category: 'number-theory',\n description: 'Generates the deficient numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(1)',\n 'let { deficient-seq } = import(\"number-theory\");\\ndeficient-seq(5)',\n ],\n seeAlso: ['number-theory.deficient-nth', 'number-theory.deficient-take-while', 'number-theory.deficient?', 'number-theory.abundant-seq', 'number-theory.perfect-seq'],\n },\n 'deficient-take-while': {\n category: 'number-theory',\n description: 'Generates the deficient numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { deficient-take-while } = import(\"number-theory\");\\ndeficient-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.deficient?'],\n },\n 'deficient-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the deficient numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the number in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(5)',\n 'let { deficient-nth } = import(\"number-theory\");\\ndeficient-nth(12)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-take-while', 'number-theory.deficient?'],\n },\n 'deficient?': {\n category: 'number-theory',\n description: 'Checks if a number is deficient.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(12)',\n 'let { deficient? } = import(\"number-theory\");\\ndeficient?(15)',\n ],\n seeAlso: ['number-theory.deficient-seq', 'number-theory.deficient-nth', 'number-theory.abundant?', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.divisors', 'number-theory.deficient-take-while'],\n },\n 'factorial-seq': {\n category: 'number-theory',\n description: 'Generates the factorial sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 19 (the maximum length of the pre-calculated factorial numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(1)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(2)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(3)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(4)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(5)',\n 'let { factorial-seq } = import(\"number-theory\");\\nfactorial-seq(10)',\n ],\n seeAlso: ['number-theory.factorial-nth', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial-take-while': {\n category: 'number-theory',\n description: 'Generates the factorial sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { factorial-take-while } = import(\"number-theory\");\\nfactorial-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?'],\n },\n 'factorial-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the factorial sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(1)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(2)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(3)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(4)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(5)',\n 'let { factorial-nth } = import(\"number-theory\");\\nfactorial-nth(10)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-take-while', 'number-theory.factorial?', 'number-theory.factorial'],\n },\n 'factorial?': {\n category: 'number-theory',\n description: 'Checks if a number is in the factorial sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(1)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(2)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(4)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(5)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(6)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(7)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(8)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(9)',\n 'let { factorial? } = import(\"number-theory\");\\nfactorial?(3628800)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial', 'number-theory.factorial-take-while'],\n },\n 'fibonacci-seq': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 79 (the maximum length of the pre-calculated Fibonacci numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(1)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq(2)',\n 'let { fibonacci-seq } = import(\"number-theory\");\\nfibonacci-seq()',\n ],\n seeAlso: ['number-theory.fibonacci-nth', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?', 'number-theory.lucas-seq', 'number-theory.tribonacci-seq', 'number-theory.pell-seq', 'number-theory.padovan-seq'],\n },\n 'fibonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the fibonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-take-while } = import(\"number-theory\");\\nfibonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.fibonacci?'],\n },\n 'fibonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the fibonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(5)',\n 'let { fibonacci-nth } = import(\"number-theory\");\\nfibonacci-nth(50)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-take-while', 'number-theory.fibonacci?'],\n },\n 'fibonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the fibonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(0)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(1)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(2)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(3)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(4)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(5)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(6)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(7)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(8)',\n 'let { fibonacci? } = import(\"number-theory\");\\nfibonacci?(9)',\n ],\n seeAlso: ['number-theory.fibonacci-seq', 'number-theory.fibonacci-nth', 'number-theory.lucas?', 'number-theory.fibonacci-take-while', 'number-theory.tribonacci?', 'number-theory.padovan?', 'number-theory.pell?'],\n },\n 'geometric-seq': {\n category: 'number-theory',\n description: 'Generates the geometric sequence for a given $start, $ratio, and $length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(3, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(2, 3, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 2, 2)',\n 'let { geometric-seq } = import(\"number-theory\");\\ngeometric-seq(1, 1.5, 12)',\n ],\n seeAlso: ['number-theory.geometric-nth', 'number-theory.geometric-take-while', 'number-theory.geometric?', 'number-theory.arithmetic-seq'],\n },\n 'geometric-take-while': {\n category: 'number-theory',\n description: 'Generates the geometric sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes a number and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { geometric-take-while } = import(\"number-theory\");\\ngeometric-take-while(1, 1.5, -> $ < 10)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.geometric?'],\n },\n 'geometric-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the geometric sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(3, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(2, 3, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 2, 2)',\n 'let { geometric-nth } = import(\"number-theory\");\\ngeometric-nth(1, 1.5, 4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-take-while', 'number-theory.geometric?'],\n },\n 'geometric?': {\n category: 'number-theory',\n description: 'Checks if a number is in the geometric sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n start: {\n type: 'number',\n description: 'The starting term of the sequence.',\n },\n ratio: {\n type: 'number',\n description: 'The common ratio of the sequence.',\n },\n n: {\n type: 'number',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n 'ratio',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 2, 1)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(2, 3, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(3, 2, 2)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, 2.25)',\n 'let { geometric? } = import(\"number-theory\");\\ngeometric?(1, 1.5, -4)',\n ],\n seeAlso: ['number-theory.geometric-seq', 'number-theory.geometric-nth', 'number-theory.arithmetic?', 'number-theory.geometric-take-while'],\n },\n 'golomb-seq': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(5)',\n 'let { golomb-seq } = import(\"number-theory\");\\ngolomb-seq(20)',\n ],\n seeAlso: ['number-theory.golomb-nth', 'number-theory.golomb-take-while', 'number-theory.golomb?', 'number-theory.recaman-seq'],\n },\n 'golomb-take-while': {\n category: 'number-theory',\n description: 'Generates the Golomb sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { golomb-take-while } = import(\"number-theory\");\\ngolomb-take-while(-> $ <= 10)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb?'],\n },\n 'golomb-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Golomb sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(5)',\n 'let { golomb-nth } = import(\"number-theory\");\\ngolomb-nth(1000)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-take-while', 'number-theory.golomb?'],\n },\n 'golomb?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Golomb sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(1)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(2)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(3345)',\n 'let { golomb? } = import(\"number-theory\");\\ngolomb?(67867864)',\n ],\n seeAlso: ['number-theory.golomb-seq', 'number-theory.golomb-nth', 'number-theory.golomb-take-while'],\n },\n 'happy-seq': {\n category: 'number-theory',\n description: 'Generates the happy sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 20 (the maximum length of the pre-calculated happy numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(1)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(2)',\n 'let { happy-seq } = import(\"number-theory\");\\nhappy-seq(20)',\n ],\n seeAlso: ['number-theory.happy-nth', 'number-theory.happy-take-while', 'number-theory.happy?', 'number-theory.lucky-seq'],\n },\n 'happy-take-while': {\n category: 'number-theory',\n description: 'Generates the happy sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { happy-take-while } = import(\"number-theory\");\\nhappy-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy?'],\n },\n 'happy-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the happy sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the happy number to return.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(1)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(2)',\n 'let { happy-nth } = import(\"number-theory\");\\nhappy-nth(20)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-take-while', 'number-theory.happy?'],\n },\n 'happy?': {\n category: 'number-theory',\n description: 'Determines if a number is a happy number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { happy? } = import(\"number-theory\");\\nhappy?(1)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(2)',\n 'let { happy? } = import(\"number-theory\");\\nhappy?(100)',\n ],\n seeAlso: ['number-theory.happy-seq', 'number-theory.happy-nth', 'number-theory.happy-take-while'],\n },\n 'juggler-seq': {\n category: 'number-theory',\n description: 'Generates the Juggler sequence starting from a given integer.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n start: {\n type: 'integer',\n description: 'The starting integer for the Juggler sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'start',\n ],\n },\n ],\n examples: [\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(3)',\n 'let { juggler-seq } = import(\"number-theory\");\\njuggler-seq(5)',\n ],\n seeAlso: ['number-theory.collatz-seq'],\n },\n 'look-and-say-seq': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence up to a specified length.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-seq } = import(\"number-theory\");\\nlook-and-say-seq(5)',\n ],\n seeAlso: ['number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say-take-while': {\n category: 'number-theory',\n description: 'Generates the Look-and-Say sequence while a condition is met.',\n returns: {\n type: 'string',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes a string and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while((term, index) -> count(term) < 10)',\n 'let { look-and-say-take-while } = import(\"number-theory\");\\nlook-and-say-take-while(-> $2 <= 10)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say?'],\n },\n 'look-and-say-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Look-and-Say sequence.',\n returns: {\n type: 'string',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { look-and-say-nth } = import(\"number-theory\");\\nlook-and-say-nth(5)',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-take-while', 'number-theory.look-and-say?'],\n },\n 'look-and-say?': {\n category: 'number-theory',\n description: 'Checks if a string is a valid Look-and-Say term.',\n returns: {\n type: 'boolean',\n },\n args: {\n term: {\n type: 'string',\n description: 'The term to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'term',\n ],\n },\n ],\n examples: [\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"111221\")',\n 'let { look-and-say? } = import(\"number-theory\");\\nlook-and-say?(\"123\")',\n ],\n seeAlso: ['number-theory.look-and-say-seq', 'number-theory.look-and-say-nth', 'number-theory.look-and-say-take-while'],\n },\n 'lucas-seq': {\n category: 'number-theory',\n description: 'Generates the lucas sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 77 (the maximum length of the pre-calculated Lucas numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(1)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq(2)',\n 'let { lucas-seq } = import(\"number-theory\");\\nlucas-seq()',\n ],\n seeAlso: ['number-theory.lucas-nth', 'number-theory.lucas-take-while', 'number-theory.lucas?', 'number-theory.fibonacci-seq'],\n },\n 'lucas-take-while': {\n category: 'number-theory',\n description: 'Generates the lucas sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucas-take-while } = import(\"number-theory\");\\nlucas-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.lucas?'],\n },\n 'lucas-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucas sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(1)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(2)',\n 'let { lucas-nth } = import(\"number-theory\");\\nlucas-nth(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-take-while', 'number-theory.lucas?'],\n },\n 'lucas?': {\n category: 'number-theory',\n description: 'Determines if a number is in the lucas sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(1)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(2)',\n 'let { lucas? } = import(\"number-theory\");\\nlucas?(10)',\n ],\n seeAlso: ['number-theory.lucas-seq', 'number-theory.lucas-nth', 'number-theory.fibonacci?', 'number-theory.lucas-take-while'],\n },\n 'lucky-seq': {\n category: 'number-theory',\n description: 'Generates the lucky sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(1)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(2)',\n 'let { lucky-seq } = import(\"number-theory\");\\nlucky-seq(20)',\n ],\n seeAlso: ['number-theory.lucky-nth', 'number-theory.lucky-take-while', 'number-theory.lucky?', 'number-theory.happy-seq', 'number-theory.prime-seq'],\n },\n 'lucky-take-while': {\n category: 'number-theory',\n description: 'Generates the lucky sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { lucky-take-while } = import(\"number-theory\");\\nlucky-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.lucky?'],\n },\n 'lucky-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the lucky sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The position in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(1)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(2)',\n 'let { lucky-nth } = import(\"number-theory\");\\nlucky-nth(20)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-take-while', 'number-theory.lucky?'],\n },\n 'lucky?': {\n category: 'number-theory',\n description: 'Checks if a number is a lucky number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(4)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(7)',\n 'let { lucky? } = import(\"number-theory\");\\nlucky?(33)',\n ],\n seeAlso: ['number-theory.lucky-seq', 'number-theory.lucky-nth', 'number-theory.prime?', 'number-theory.lucky-take-while'],\n },\n 'mersenne-seq': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 9 (the maximum length of the pre-calculated mersenne numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(1)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq(5)',\n 'let { mersenne-seq } = import(\"number-theory\");\\nmersenne-seq()',\n ],\n seeAlso: ['number-theory.mersenne-nth', 'number-theory.mersenne-take-while', 'number-theory.mersenne?', 'number-theory.prime-seq'],\n },\n 'mersenne-take-while': {\n category: 'number-theory',\n description: 'Generates the Mersenne sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { mersenne-take-while } = import(\"number-theory\");\\nmersenne-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.mersenne?'],\n },\n 'mersenne-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Mersenne sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(1)',\n 'let { mersenne-nth } = import(\"number-theory\");\\nmersenne-nth(5)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-take-while', 'number-theory.mersenne?'],\n },\n 'mersenne?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Mersenne sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(3)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(4)',\n 'let { mersenne? } = import(\"number-theory\");\\nmersenne?(7)',\n ],\n seeAlso: ['number-theory.mersenne-seq', 'number-theory.mersenne-nth', 'number-theory.prime?', 'number-theory.mersenne-take-while'],\n },\n 'padovan-seq': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(5)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(10)',\n 'let { padovan-seq } = import(\"number-theory\");\\npadovan-seq(20)',\n ],\n seeAlso: ['number-theory.padovan-nth', 'number-theory.padovan-take-while', 'number-theory.padovan?', 'number-theory.fibonacci-seq'],\n },\n 'padovan-take-while': {\n category: 'number-theory',\n description: 'Generates the Padovan sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { padovan-take-while } = import(\"number-theory\");\\npadovan-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.padovan?'],\n },\n 'padovan-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Padovan sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(5)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(10)',\n 'let { padovan-nth } = import(\"number-theory\");\\npadovan-nth(20)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-take-while', 'number-theory.padovan?'],\n },\n 'padovan?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Padovan sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(1)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(265)',\n 'let { padovan? } = import(\"number-theory\");\\npadovan?(6)',\n ],\n seeAlso: ['number-theory.padovan-seq', 'number-theory.padovan-nth', 'number-theory.fibonacci?', 'number-theory.padovan-take-while'],\n },\n 'partition-seq': {\n category: 'number-theory',\n description: 'Generates the partition numbers up to a specified length. If no length is provided, it defaults to 299 (the maximum length of the pre-calculated partition numbers).',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(1)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq(10)',\n 'let { partition-seq } = import(\"number-theory\");\\npartition-seq()',\n ],\n seeAlso: ['number-theory.partition-nth', 'number-theory.partition-take-while', 'number-theory.partition?', 'number-theory.partitions', 'number-theory.count-partitions'],\n },\n 'partition-take-while': {\n category: 'number-theory',\n description: 'Generates the partition numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { partition-take-while } = import(\"number-theory\");\\npartition-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partition?'],\n },\n 'partition-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the partition numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the partition number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(1)',\n 'let { partition-nth } = import(\"number-theory\");\\npartition-nth(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-take-while', 'number-theory.partition?'],\n },\n 'partition?': {\n category: 'number-theory',\n description: 'Checks if a number is in the partition numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partition? } = import(\"number-theory\");\\npartition?(0)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(1)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(2)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(3)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(4)',\n 'let { partition? } = import(\"number-theory\");\\npartition?(5)',\n ],\n seeAlso: ['number-theory.partition-seq', 'number-theory.partition-nth', 'number-theory.partitions', 'number-theory.partition-take-while'],\n },\n 'pell-seq': {\n category: 'number-theory',\n description: 'Generates the Pell sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 42 (the maximum length of the pre-calculated Pell numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(5)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq(10)',\n 'let { pell-seq } = import(\"number-theory\");\\npell-seq()',\n ],\n seeAlso: ['number-theory.pell-nth', 'number-theory.pell-take-while', 'number-theory.pell?', 'number-theory.fibonacci-seq'],\n },\n 'pell-take-while': {\n category: 'number-theory',\n description: 'Generates the Pell sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { pell-take-while } = import(\"number-theory\");\\npell-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.pell?'],\n },\n 'pell-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Pell sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(5)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(10)',\n 'let { pell-nth } = import(\"number-theory\");\\npell-nth(20)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-take-while', 'number-theory.pell?'],\n },\n 'pell?': {\n category: 'number-theory',\n description: 'Checks if a number is a Pell number.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { pell? } = import(\"number-theory\");\\npell?(1)',\n 'let { pell? } = import(\"number-theory\");\\npell?(470832)',\n 'let { pell? } = import(\"number-theory\");\\npell?(10)',\n ],\n seeAlso: ['number-theory.pell-seq', 'number-theory.pell-nth', 'number-theory.fibonacci?', 'number-theory.pell-take-while'],\n },\n 'perfect-seq': {\n category: 'number-theory',\n description: 'Generates the perfect numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If no length is provided, it defaults to 7 (the maximum length of the pre-calculated perfect numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(1)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq(5)',\n 'let { perfect-seq } = import(\"number-theory\");\\nperfect-seq()',\n ],\n seeAlso: ['number-theory.perfect-nth', 'number-theory.perfect-take-while', 'number-theory.perfect?', 'number-theory.abundant-seq', 'number-theory.deficient-seq', 'number-theory.amicable?'],\n },\n 'perfect-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-take-while } = import(\"number-theory\");\\nperfect-take-while(-> $ < 1000)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.perfect?'],\n },\n 'perfect-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the perfect number to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(1)',\n 'let { perfect-nth } = import(\"number-theory\");\\nperfect-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-take-while', 'number-theory.perfect?'],\n },\n 'perfect?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(0)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(1)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(2)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(3)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(4)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(5)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(6)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(7)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(8)',\n 'let { perfect? } = import(\"number-theory\");\\nperfect?(9)',\n ],\n seeAlso: ['number-theory.perfect-seq', 'number-theory.perfect-nth', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.sigma', 'number-theory.perfect-take-while', 'number-theory.amicable?', 'number-theory.proper-divisors'],\n },\n 'perfect-square-seq': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(5)',\n 'let { perfect-square-seq } = import(\"number-theory\");\\nperfect-square-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-square-nth', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?', 'number-theory.perfect-cube-seq', 'number-theory.perfect-power-seq', 'number-theory.polygonal-seq'],\n },\n 'perfect-square-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect square numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-take-while } = import(\"number-theory\");\\nperfect-square-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-square?'],\n },\n 'perfect-square-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect square numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(1)',\n 'let { perfect-square-nth } = import(\"number-theory\");\\nperfect-square-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-take-while', 'number-theory.perfect-square?'],\n },\n 'perfect-square?': {\n category: 'number-theory',\n description: 'Checks if a number is a perfect square.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(16)',\n 'let { perfect-square? } = import(\"number-theory\");\\nperfect-square?(20)',\n ],\n seeAlso: ['number-theory.perfect-square-seq', 'number-theory.perfect-square-nth', 'number-theory.perfect-cube?', 'number-theory.perfect-power?', 'number-theory.perfect-square-take-while', 'number-theory.perfect-power', 'number-theory.polygonal?'],\n },\n 'perfect-cube-seq': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(5)',\n 'let { perfect-cube-seq } = import(\"number-theory\");\\nperfect-cube-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-cube-nth', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?', 'number-theory.perfect-square-seq', 'number-theory.perfect-power-seq'],\n },\n 'perfect-cube-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect cube numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-take-while } = import(\"number-theory\");\\nperfect-cube-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect cube numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(1)',\n 'let { perfect-cube-nth } = import(\"number-theory\");\\nperfect-cube-nth(5)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-cube?'],\n },\n 'perfect-cube?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect cube numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(7)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(8)',\n 'let { perfect-cube? } = import(\"number-theory\");\\nperfect-cube?(9)',\n ],\n seeAlso: ['number-theory.perfect-cube-seq', 'number-theory.perfect-cube-nth', 'number-theory.perfect-square?', 'number-theory.perfect-power?', 'number-theory.perfect-cube-take-while', 'number-theory.perfect-power'],\n },\n 'perfect-power-seq': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(5)',\n 'let { perfect-power-seq } = import(\"number-theory\");\\nperfect-power-seq(20)',\n ],\n seeAlso: ['number-theory.perfect-power-nth', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?', 'number-theory.perfect-power', 'number-theory.perfect-square-seq', 'number-theory.perfect-cube-seq'],\n },\n 'perfect-power-take-while': {\n category: 'number-theory',\n description: 'Generates the perfect power numbers while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-take-while } = import(\"number-theory\");\\nperfect-power-take-while(-> $ <= 100)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power?'],\n },\n 'perfect-power-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the perfect power numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(3)',\n 'let { perfect-power-nth } = import(\"number-theory\");\\nperfect-power-nth(15)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-take-while', 'number-theory.perfect-power?'],\n },\n 'perfect-power?': {\n category: 'number-theory',\n description: 'Checks if a number is in the perfect power numbers.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(7)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(8)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(9)',\n 'let { perfect-power? } = import(\"number-theory\");\\nperfect-power?(10)',\n ],\n seeAlso: ['number-theory.perfect-power-seq', 'number-theory.perfect-power-nth', 'number-theory.perfect-power', 'number-theory.perfect-square?', 'number-theory.perfect-cube?', 'number-theory.perfect-power-take-while'],\n },\n 'polygonal-seq': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence for a given number of sides and length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'length',\n ],\n },\n ],\n examples: [\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(3, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(4, 2)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(5, 3)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(6, 5)',\n 'let { polygonal-seq } = import(\"number-theory\");\\npolygonal-seq(100, 10)',\n ],\n seeAlso: ['number-theory.polygonal-nth', 'number-theory.polygonal-take-while', 'number-theory.polygonal?', 'number-theory.perfect-square-seq'],\n },\n 'polygonal-take-while': {\n category: 'number-theory',\n description: 'Generates the polygonal sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'function',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { polygonal-take-while } = import(\"number-theory\");\\npolygonal-take-while(15, -> $ < 1000)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.polygonal?'],\n },\n 'polygonal-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the polygonal sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(3, 9)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(4, 5)',\n 'let { polygonal-nth } = import(\"number-theory\");\\npolygonal-nth(5, 5)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-take-while', 'number-theory.polygonal?'],\n },\n 'polygonal?': {\n category: 'number-theory',\n description: 'Checks if a number is in the polygonal sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n sides: {\n type: 'integer',\n description: 'The number of sides of the polygon.',\n },\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sides',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 10)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(3, 9)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 10000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(4, 1000)',\n 'let { polygonal? } = import(\"number-theory\");\\npolygonal?(6, 45)',\n ],\n seeAlso: ['number-theory.polygonal-seq', 'number-theory.polygonal-nth', 'number-theory.perfect-square?', 'number-theory.polygonal-take-while'],\n },\n 'prime-seq': {\n category: 'number-theory',\n description: 'Generates the prime sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(1)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(2)',\n 'let { prime-seq } = import(\"number-theory\");\\nprime-seq(10)',\n ],\n seeAlso: ['number-theory.prime-nth', 'number-theory.prime-take-while', 'number-theory.prime?', 'number-theory.composite-seq', 'number-theory.mersenne-seq', 'number-theory.lucky-seq'],\n },\n 'prime-take-while': {\n category: 'number-theory',\n description: 'Generates the prime sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { prime-take-while } = import(\"number-theory\");\\nprime-take-while(-> $ < 50)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.prime?'],\n },\n 'prime-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the prime sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(1)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(2)',\n 'let { prime-nth } = import(\"number-theory\");\\nprime-nth(10)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-take-while', 'number-theory.prime?'],\n },\n 'prime?': {\n category: 'number-theory',\n description: 'Determines if a number is prime.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime? } = import(\"number-theory\");\\nprime?(1)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(2)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(3)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(4)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(997)',\n 'let { prime? } = import(\"number-theory\");\\nprime?(1001)',\n ],\n seeAlso: ['number-theory.prime-seq', 'number-theory.prime-nth', 'number-theory.composite?', 'number-theory.prime-factors', 'number-theory.mersenne?', 'number-theory.prime-take-while', 'number-theory.lucky?'],\n },\n 'recaman-seq': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(5)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(10)',\n 'let { recaman-seq } = import(\"number-theory\");\\nrecaman-seq(20)',\n ],\n seeAlso: ['number-theory.recaman-nth', 'number-theory.recaman-take-while', 'number-theory.recaman?', 'number-theory.golomb-seq'],\n },\n 'recaman-take-while': {\n category: 'number-theory',\n description: 'Generates the Recaman sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { recaman-take-while } = import(\"number-theory\");\\nrecaman-take-while(-> $ < 10)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman?'],\n },\n 'recaman-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Recaman sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(5)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(10)',\n 'let { recaman-nth } = import(\"number-theory\");\\nrecaman-nth(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-take-while', 'number-theory.recaman?'],\n },\n 'recaman?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Recaman sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(5)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(10)',\n 'let { recaman? } = import(\"number-theory\");\\nrecaman?(20)',\n ],\n seeAlso: ['number-theory.recaman-seq', 'number-theory.recaman-nth', 'number-theory.recaman-take-while'],\n },\n 'sylvester-seq': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate. If not provided, the default is 6 (the maximum length of the pre-calculated Sylvester numbers).',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n {\n argumentNames: [],\n },\n ],\n examples: [\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq(5)',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n 'let { sylvester-seq } = import(\"number-theory\");\\nsylvester-seq()',\n ],\n seeAlso: ['number-theory.sylvester-nth', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester-take-while': {\n category: 'number-theory',\n description: 'Generates the Sylvester sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { sylvester-take-while } = import(\"number-theory\");\\nsylvester-take-while(-> $ < 100000)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester?'],\n },\n 'sylvester-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Sylvester sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(1)',\n 'let { sylvester-nth } = import(\"number-theory\");\\nsylvester-nth(5)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-take-while', 'number-theory.sylvester?'],\n },\n 'sylvester?': {\n category: 'number-theory',\n description: 'Checks if a number is in the Sylvester sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(2)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(3)',\n 'let { sylvester? } = import(\"number-theory\");\\nsylvester?(6)',\n ],\n seeAlso: ['number-theory.sylvester-seq', 'number-theory.sylvester-nth', 'number-theory.sylvester-take-while'],\n },\n 'thue-morse-seq': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(5)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(10)',\n 'let { thue-morse-seq } = import(\"number-theory\");\\nthue-morse-seq(20)',\n ],\n seeAlso: ['number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse-take-while': {\n category: 'number-theory',\n description: 'Generates the Thue-Morse sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-take-while } = import(\"number-theory\");\\nthue-morse-take-while(-> $2 < 10)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse?'],\n },\n 'thue-morse-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the Thue-Morse sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term in the sequence.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(5)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(10)',\n 'let { thue-morse-nth } = import(\"number-theory\");\\nthue-morse-nth(20)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-take-while', 'number-theory.thue-morse?'],\n },\n 'thue-morse?': {\n category: 'number-theory',\n description: 'Checks if a number is part of the Thue-Morse sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(1)',\n 'let { thue-morse? } = import(\"number-theory\");\\nthue-morse?(2)',\n ],\n seeAlso: ['number-theory.thue-morse-seq', 'number-theory.thue-morse-nth', 'number-theory.thue-morse-take-while'],\n },\n 'tribonacci-seq': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence up to a specified length.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n length: {\n type: 'integer',\n description: 'The length of the sequence to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'length',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(1)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(2)',\n 'let { tribonacci-seq } = import(\"number-theory\");\\ntribonacci-seq(10)',\n ],\n seeAlso: ['number-theory.tribonacci-nth', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?', 'number-theory.fibonacci-seq'],\n },\n 'tribonacci-take-while': {\n category: 'number-theory',\n description: 'Generates the tribonacci sequence while a condition is met.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n takeWhile: {\n type: 'function',\n description: 'A function that takes an integer and an index and returns a boolean.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'takeWhile',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-take-while } = import(\"number-theory\");\\ntribonacci-take-while(-> $ < 100)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.tribonacci?'],\n },\n 'tribonacci-nth': {\n category: 'number-theory',\n description: 'Generates the nth term of the tribonacci sequence.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The index of the term to generate.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(1)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(2)',\n 'let { tribonacci-nth } = import(\"number-theory\");\\ntribonacci-nth(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-take-while', 'number-theory.tribonacci?'],\n },\n 'tribonacci?': {\n category: 'number-theory',\n description: 'Determines if a number is in the tribonacci sequence.',\n returns: {\n type: 'boolean',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(0)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(1)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(2)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(3)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(4)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(5)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(6)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(7)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(8)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(9)',\n 'let { tribonacci? } = import(\"number-theory\");\\ntribonacci?(10)',\n ],\n seeAlso: ['number-theory.tribonacci-seq', 'number-theory.tribonacci-nth', 'number-theory.fibonacci?', 'number-theory.tribonacci-take-while'],\n },\n 'count-combinations': {\n category: 'number-theory',\n description: 'Calculates the number of combinations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(5, 3)',\n 'let { count-combinations } = import(\"number-theory\");\\ncount-combinations(10, 2)',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.count-permutations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-second', 'number-theory.count-partitions', 'number-theory.count-power-set'],\n },\n 'combinations': {\n category: 'number-theory',\n description: 'Generates all possible combinations of a specified size from a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate combinations from.',\n },\n n: {\n type: 'integer',\n description: 'The size of each combination.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n 'n',\n ],\n },\n ],\n examples: [\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([\"a\", \"b\", \"c\"], 2)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 0)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 1)',\n 'let { combinations } = import(\"number-theory\");\\ncombinations([1, 2, 3], 3)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.permutations', 'number-theory.power-set', 'number-theory.cartesian-product', 'number-theory.partitions'],\n },\n 'count-derangements': {\n category: 'number-theory',\n description: 'Calculates the number of derangements (permutations where no element appears in its original position) of n items.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The total number of items.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(4)',\n 'let { count-derangements } = import(\"number-theory\");\\ncount-derangements(5)',\n ],\n seeAlso: ['number-theory.derangements', 'number-theory.count-permutations', 'number-theory.factorial'],\n },\n 'derangements': {\n category: 'number-theory',\n description: 'Generates all derangements (permutations where no element appears in its original position) of a set.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate derangements from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { derangements } = import(\"number-theory\");\\nderangements([1, 2, 3, 4])',\n 'let { derangements } = import(\"number-theory\");\\nderangements([\"a\", \"b\", \"c\"])',\n ],\n seeAlso: ['number-theory.count-derangements', 'number-theory.permutations'],\n },\n 'divisors': {\n category: 'number-theory',\n description: 'Returns the divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { divisors } = import(\"number-theory\");\\ndivisors(12)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(100)',\n 'let { divisors } = import(\"number-theory\");\\ndivisors(37)',\n ],\n seeAlso: ['number-theory.count-divisors', 'number-theory.proper-divisors', 'number-theory.sigma', 'number-theory.prime-factors', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.count-proper-divisors'],\n },\n 'count-divisors': {\n category: 'number-theory',\n description: 'Returns the number of divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(12)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(100)',\n 'let { count-divisors } = import(\"number-theory\");\\ncount-divisors(37)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.count-proper-divisors', 'number-theory.sigma'],\n },\n 'proper-divisors': {\n category: 'number-theory',\n description: 'Returns the proper divisors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(12)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(100)',\n 'let { proper-divisors } = import(\"number-theory\");\\nproper-divisors(37)',\n ],\n seeAlso: ['number-theory.count-proper-divisors', 'number-theory.divisors', 'number-theory.amicable?', 'number-theory.perfect?'],\n },\n 'count-proper-divisors': {\n category: 'number-theory',\n description: 'Returns the number of proper divisors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count proper divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(12)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(100)',\n 'let { count-proper-divisors } = import(\"number-theory\");\\ncount-proper-divisors(37)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.count-divisors', 'number-theory.divisors'],\n },\n 'factorial': {\n category: 'number-theory',\n description: 'Calculates the factorial of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the factorial for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { factorial } = import(\"number-theory\");\\nfactorial(5)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(0)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(10)',\n 'let { factorial } = import(\"number-theory\");\\nfactorial(20)',\n ],\n seeAlso: ['number-theory.factorial-seq', 'number-theory.factorial-nth', 'number-theory.factorial?', 'number-theory.count-combinations', 'number-theory.count-permutations', 'number-theory.multinomial', 'number-theory.count-derangements'],\n },\n 'partitions': {\n category: 'number-theory',\n description: 'Generates all partitions of a number.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to partition.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { partitions } = import(\"number-theory\");\\npartitions(4)',\n 'let { partitions } = import(\"number-theory\");\\npartitions(8)',\n ],\n seeAlso: ['number-theory.count-partitions', 'number-theory.partition-seq', 'number-theory.combinations', 'number-theory.partition?'],\n },\n 'count-partitions': {\n category: 'number-theory',\n description: 'Returns the number of partitions of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count partitions for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(4)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(8)',\n 'let { count-partitions } = import(\"number-theory\");\\ncount-partitions(15)',\n ],\n seeAlso: ['number-theory.partitions', 'number-theory.partition-seq', 'number-theory.count-combinations'],\n },\n 'permutations': {\n category: 'number-theory',\n description: 'Generates all permutations of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'array',\n array: true,\n description: 'The input collection to generate permutations from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([\"a\", \"b\", \"c\"])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2, 3, 4])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1, 2])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([1])',\n 'let { permutations } = import(\"number-theory\");\\npermutations([])',\n ],\n seeAlso: ['number-theory.count-permutations', 'number-theory.combinations', 'number-theory.derangements', 'number-theory.cartesian-product'],\n },\n 'count-permutations': {\n category: 'number-theory',\n description: 'Returns the number of permutations of n items taken k at a time.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(5, 3)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 2)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 10)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 0)',\n 'let { count-permutations } = import(\"number-theory\");\\ncount-permutations(10, 1)',\n ],\n seeAlso: ['number-theory.permutations', 'number-theory.count-combinations', 'number-theory.factorial', 'number-theory.multinomial', 'number-theory.stirling-first', 'number-theory.count-derangements'],\n },\n 'power-set': {\n category: 'number-theory',\n description: 'Generates the power set of a collection.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n set: {\n type: 'any',\n array: true,\n description: 'The input collection to generate the power set from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'set',\n ],\n },\n ],\n examples: [\n 'let { power-set } = import(\"number-theory\");\\npower-set([\"a\", \"b\", \"c\"])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1, 2])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([1])',\n 'let { power-set } = import(\"number-theory\");\\npower-set([])',\n ],\n seeAlso: ['number-theory.count-power-set', 'number-theory.combinations', 'number-theory.cartesian-product'],\n },\n 'count-power-set': {\n category: 'number-theory',\n description: 'Returns the number of subsets of a set.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the set.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(3)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(5)',\n 'let { count-power-set } = import(\"number-theory\");\\ncount-power-set(10)',\n ],\n seeAlso: ['number-theory.power-set', 'number-theory.count-combinations'],\n },\n 'prime-factors': {\n category: 'number-theory',\n description: 'Returns the prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to factor.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(12)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(100)',\n 'let { prime-factors } = import(\"number-theory\");\\nprime-factors(37)',\n ],\n seeAlso: ['number-theory.count-prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.prime?', 'number-theory.divisors', 'number-theory.euler-totient', 'number-theory.mobius', 'number-theory.composite?', 'number-theory.count-distinct-prime-factors'],\n },\n 'count-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(12)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(100)',\n 'let { count-prime-factors } = import(\"number-theory\");\\ncount-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.distinct-prime-factors', 'number-theory.count-distinct-prime-factors'],\n },\n 'distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the distinct prime factors of a number.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to find distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(12)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(100)',\n 'let { distinct-prime-factors } = import(\"number-theory\");\\ndistinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.prime-factors', 'number-theory.count-distinct-prime-factors', 'number-theory.count-prime-factors'],\n },\n 'count-distinct-prime-factors': {\n category: 'number-theory',\n description: 'Returns the number of distinct prime factors of a number.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to count distinct prime factors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(12)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(100)',\n 'let { count-distinct-prime-factors } = import(\"number-theory\");\\ncount-distinct-prime-factors(37)',\n ],\n seeAlso: ['number-theory.distinct-prime-factors', 'number-theory.prime-factors', 'number-theory.count-prime-factors'],\n },\n 'coprime?': {\n category: 'number-theory',\n description: 'Checks if two numbers are coprime (i.e., their GCD is 1).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 8)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(12, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(37, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 5)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(5, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 0)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(0, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(1, 1)',\n 'let { coprime? } = import(\"number-theory\");\\ncoprime?(2, 3)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.euler-totient', 'number-theory.divisible-by?', 'number-theory.lcm', 'number-theory.carmichael-lambda'],\n },\n 'divisible-by?': {\n category: 'number-theory',\n description: 'Checks if a number is divisible by another number.',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 4)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(12, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(37, 1)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 0)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(0, 5)',\n 'let { divisible-by? } = import(\"number-theory\");\\ndivisible-by?(5, 0)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.gcd', 'number-theory.coprime?'],\n },\n 'gcd': {\n category: 'number-theory',\n description: 'Calculates the greatest common divisor (GCD) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { gcd } = import(\"number-theory\");\\ngcd(100, 25)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(37, 1)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 0)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(0, 5)',\n 'let { gcd } = import(\"number-theory\");\\ngcd(5, 0)',\n ],\n seeAlso: ['number-theory.lcm', 'number-theory.extended-gcd', 'number-theory.coprime?', 'number-theory.divisible-by?'],\n },\n 'lcm': {\n category: 'number-theory',\n description: 'Calculates the least common multiple (LCM) of two numbers.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { lcm } = import(\"number-theory\");\\nlcm(100, 25)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(37, 1)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(0, 5)',\n 'let { lcm } = import(\"number-theory\");\\nlcm(5, 0)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.divisors', 'number-theory.coprime?'],\n },\n 'multinomial': {\n category: 'number-theory',\n description: 'Calculates the multinomial coefficient from of a list of numbers representing the sizes of each group.',\n returns: {\n type: 'integer',\n },\n args: {\n args: {\n type: 'integer',\n rest: true,\n description: 'The numbers representing the sizes of each group.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'args',\n ],\n },\n ],\n examples: [\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(5, 2, 3)',\n 'let { multinomial } = import(\"number-theory\");\\nmultinomial(10, 2, 3, 5)',\n ],\n seeAlso: ['number-theory.count-combinations', 'number-theory.factorial', 'number-theory.count-permutations'],\n hideOperatorForm: true,\n },\n 'amicable?': {\n category: 'number-theory',\n description: 'Checks if two numbers are amicable (i.e., the sum of the proper divisors of each number equals the other number).',\n returns: {\n type: 'boolean',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { amicable? } = import(\"number-theory\");\\namicable?(220, 284)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(1184, 1210)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(2620, 2924)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(5020, 5564)',\n 'let { amicable? } = import(\"number-theory\");\\namicable?(6232, 6368)',\n ],\n seeAlso: ['number-theory.proper-divisors', 'number-theory.perfect?', 'number-theory.sigma', 'number-theory.perfect-seq'],\n },\n 'euler-totient': {\n category: 'number-theory',\n description: 'Calculates the Euler\\'s totient function (φ(n)) of a number, which counts the integers up to n that are coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the totient for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(1)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(2)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(10)',\n 'let { euler-totient } = import(\"number-theory\");\\neuler-totient(20)',\n ],\n seeAlso: ['number-theory.coprime?', 'number-theory.carmichael-lambda', 'number-theory.mobius', 'number-theory.prime-factors', 'number-theory.mertens'],\n },\n 'mobius': {\n category: 'number-theory',\n description: 'Calculates the Möbius function (μ(n)) of a number, which is used in number theory.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Möbius function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mertens', 'number-theory.euler-totient', 'number-theory.prime-factors'],\n },\n 'mertens': {\n category: 'number-theory',\n description: 'Calculates the Mertens function (M(n)) of a number, which is the sum of the Möbius function up to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Mertens function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { mobius } = import(\"number-theory\");\\nmobius(1)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(2)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(3)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(4)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(6)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(12)',\n 'let { mobius } = import(\"number-theory\");\\nmobius(30)',\n ],\n seeAlso: ['number-theory.mobius', 'number-theory.euler-totient'],\n },\n 'sigma': {\n category: 'number-theory',\n description: 'Calculates the sum of divisors function (σ(n)) of a number, which is the sum of all positive divisors of n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the sum of divisors for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { sigma } = import(\"number-theory\");\\nsigma(1)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(2)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(3)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(4)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(6)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(12)',\n 'let { sigma } = import(\"number-theory\");\\nsigma(30)',\n ],\n seeAlso: ['number-theory.divisors', 'number-theory.perfect?', 'number-theory.abundant?', 'number-theory.deficient?', 'number-theory.amicable?', 'number-theory.count-divisors'],\n },\n 'carmichael-lambda': {\n category: 'number-theory',\n description: 'Calculates the Carmichael function (λ(n)) of a number, which is the smallest positive integer m such that a^m ≡ 1 (mod n) for all integers a coprime to n.',\n returns: {\n type: 'integer',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to calculate the Carmichael function for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(1)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(2)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(3)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(4)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(6)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(12)',\n 'let { carmichael-lambda } = import(\"number-theory\");\\ncarmichael-lambda(30)',\n ],\n seeAlso: ['number-theory.euler-totient', 'number-theory.mod-exp', 'number-theory.coprime?'],\n },\n 'cartesian-product': {\n category: 'number-theory',\n description: 'Calculates the Cartesian product of two or more sets.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n sets: {\n type: 'array',\n array: true,\n description: 'The input collections to calculate the Cartesian product from.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'sets',\n ],\n },\n ],\n examples: [\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2], [\"a\", \"b\"], [true, false])',\n 'let { cartesian-product } = import(\"number-theory\");\\ncartesian-product([1, 2, 3], [\"x\", \"y\", \"z\"])',\n ],\n seeAlso: ['number-theory.combinations', 'number-theory.power-set', 'number-theory.permutations'],\n },\n 'perfect-power': {\n category: 'number-theory',\n description: 'Returns a tuple of the base and exponent if the number is a perfect power, otherwise returns null.',\n returns: {\n type: 'array',\n array: true,\n },\n args: {\n n: {\n type: 'integer',\n description: 'The number to check.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(1)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(2)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(4)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(8)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(9)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(16)',\n 'let { perfect-power } = import(\"number-theory\");\\nperfect-power(19)',\n ],\n seeAlso: ['number-theory.perfect-power?', 'number-theory.perfect-power-seq', 'number-theory.perfect-square?', 'number-theory.perfect-cube?'],\n },\n 'mod-exp': {\n category: 'number-theory',\n description: 'Calculates the modular exponentiation of a base raised to an exponent modulo a modulus.',\n returns: {\n type: 'integer',\n },\n args: {\n base: {\n type: 'integer',\n },\n exponent: {\n type: 'integer',\n },\n modulus: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'base',\n 'exponent',\n 'modulus',\n ],\n },\n ],\n examples: [\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(2, 3, 5)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(3, 4, 7)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(5, 6, 11)',\n 'let { mod-exp } = import(\"number-theory\");\\nmod-exp(7, 8, 13)',\n ],\n seeAlso: ['number-theory.mod-inv', 'number-theory.carmichael-lambda', 'number-theory.chinese-remainder'],\n },\n 'mod-inv': {\n category: 'number-theory',\n description: 'Calculates the modular multiplicative inverse of a number modulo another number.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'm',\n ],\n },\n ],\n examples: [\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(3, 11)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(10, 17)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(5, 13)',\n 'let { mod-inv } = import(\"number-theory\");\\nmod-inv(7, 19)',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.extended-gcd', 'number-theory.chinese-remainder'],\n },\n 'extended-gcd': {\n category: 'number-theory',\n description: 'Calculates the extended greatest common divisor (GCD) of two numbers, returning the GCD and the coefficients of Bézout\\'s identity.',\n returns: {\n type: 'integer',\n array: true,\n },\n args: {\n a: {\n type: 'integer',\n },\n b: {\n type: 'integer',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(30, 12)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(56, 98)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(101, 10)',\n 'let { extended-gcd } = import(\"number-theory\");\\nextended-gcd(17, 13)',\n ],\n seeAlso: ['number-theory.gcd', 'number-theory.mod-inv', 'number-theory.chinese-remainder'],\n },\n 'chinese-remainder': {\n category: 'number-theory',\n description: 'Solves a system of simultaneous congruences using the Chinese Remainder Theorem.',\n returns: {\n type: 'integer',\n },\n args: {\n remainders: {\n type: 'integer',\n array: true,\n description: 'The remainders of the congruences.',\n },\n moduli: {\n type: 'integer',\n array: true,\n description: 'The moduli of the congruences.',\n },\n a: {\n type: 'array',\n },\n b: {\n type: 'array',\n },\n },\n variants: [\n {\n argumentNames: [\n 'remainders',\n 'moduli',\n ],\n },\n ],\n examples: [\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([2, 3], [3, 5])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2], [3, 4])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([0, 1], [2, 3])',\n 'let { chinese-remainder } = import(\"number-theory\");\\nchinese-remainder([1, 2, 3], [4, 5, 7])',\n ],\n seeAlso: ['number-theory.mod-exp', 'number-theory.mod-inv', 'number-theory.extended-gcd'],\n },\n 'stirling-first': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the first kind, which count the number of permutations of n elements with k cycles.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of cycles.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(5, 2)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(4, 3)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(6, 1)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(7, 4)',\n 'let { stirling-first } = import(\"number-theory\");\\nstirling-first(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-second', 'number-theory.bell-seq', 'number-theory.count-permutations'],\n },\n 'stirling-second': {\n category: 'number-theory',\n description: 'Calculates the Stirling numbers of the second kind, which count the number of ways to partition n elements into k non-empty subsets.',\n returns: {\n type: 'integer',\n },\n args: {\n a: {\n type: 'integer',\n description: 'The number of elements.',\n },\n b: {\n type: 'integer',\n description: 'The number of subsets.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(5, 2)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(4, 3)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(6, 1)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(7, 4)',\n 'let { stirling-second } = import(\"number-theory\");\\nstirling-second(8, 5)',\n ],\n seeAlso: ['number-theory.stirling-first', 'number-theory.bell-seq', 'number-theory.count-combinations'],\n },\n}\n","export function binomialCoefficient(n: number, k: number): number {\n if (k === 0 || k === n)\n return 1\n\n let result = 1\n for (let i = 0; i < k; i++)\n result *= (n - i) / (i + 1)\n\n return result\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { binomialCoefficient } from './binomialCefficient'\n\n/**\n * Generates all possible combinations of a specified size from a collection.\n * @param collection The input collection to generate combinations from\n * @param size The size of each combination\n * @returns An array of arrays, where each inner array is a combination of the specified size\n */\nfunction combinations<T>(collection: T[], size: number): T[][] {\n // Base case: if size is 1, return each element as its own combination\n if (size === 1) {\n return collection.map(item => [item])\n }\n\n const result: T[][] = []\n\n // Recursive approach to build combinations\n for (let i = 0; i <= collection.length - size; i++) {\n // Take the current element\n const current = collection[i]!\n\n // Get all combinations of size-1 from the rest of the elements\n const subCombinations = combinations(\n collection.slice(i + 1),\n size - 1,\n )\n\n // Add the current element to each sub-combination\n for (const subComb of subCombinations) {\n result.push([current, ...subComb])\n }\n }\n\n return result\n}\n\nexport const combinationsNormalExpressions: BuiltinNormalExpressions = {\n 'combinations': {\n evaluate: ([set, n], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: set.length })\n if (n === 0)\n return [[]]\n return combinations(set, n)\n },\n arity: toFixedArity(2),\n },\n 'count-combinations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return binomialCoefficient(n, k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction getAllDerangements(arr: Arr): Arr[] {\n const n = arr.length\n const result: Arr[] = []\n const used = Array.from({ length: n }, () => false)\n const temp: Arr = Array.from({ length: n })\n\n function generateDerangements(pos: number): void {\n if (pos === n) {\n result.push([...temp])\n return\n }\n\n for (let i = 0; i < n; i++) {\n // Skip if element is already used or would be in its original position\n if (used[i] || i === pos) {\n continue\n }\n\n used[i] = true\n temp[pos] = arr[i]!\n generateDerangements(pos + 1)\n used[i] = false\n }\n }\n\n generateDerangements(0)\n return result\n}\n\nfunction countDerangements(n: number): number {\n if (n === 1)\n return 0\n\n let a = 1 // !0\n let b = 0 // !1\n let result = 0\n\n for (let i = 2; i <= n; i++) {\n result = (i - 1) * (a + b)\n a = b\n b = result\n }\n\n return result\n}\n\nexport const derangementsNormalExpressions: BuiltinNormalExpressions = {\n 'derangements': {\n evaluate: ([set], sourceCodeInfo): Arr => {\n assertArray(set, sourceCodeInfo)\n return getAllDerangements(set)\n },\n arity: toFixedArity(1),\n },\n 'count-derangements': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return countDerangements(n)\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction calcUnsortedDivisors(number: number): number[] {\n const divisors: number[] = []\n for (let i = 1; i <= Math.sqrt(number); i++) {\n if (number % i === 0) {\n divisors.push(i)\n if (i !== number / i) {\n divisors.push(number / i)\n }\n }\n }\n return divisors\n}\n\nexport function getDivisors(n: number): number[] {\n const unsortedDivisors = calcUnsortedDivisors(n)\n const sortedDivisors = unsortedDivisors.sort((a, b) => a - b)\n return sortedDivisors\n}\n\nexport function getProperDivisors(n: number): number[] {\n return getDivisors(n).slice(0, -1) // Exclude the number itself\n}\n\nexport const divisorsNormalExpressions: BuiltinNormalExpressions = {\n 'divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length\n },\n arity: toFixedArity(1),\n },\n 'proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return getProperDivisors(number)\n },\n arity: toFixedArity(1),\n },\n 'count-proper-divisors': {\n evaluate: ([number], sourceCodeInfo): number => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return calcUnsortedDivisors(number).length - 1 // Exclude the number itself\n },\n arity: toFixedArity(1),\n },\n}\n","export const factorialNumbers = [\n 1,\n 1,\n 2,\n 6,\n 24,\n 120,\n 720,\n 5040,\n 40320,\n 362880,\n 3628800,\n 39916800,\n 479001600,\n 6227020800,\n 87178291200,\n 1307674368000,\n 20922789888000,\n 355687428096000,\n 6402373705728000,\n]\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialNumbers } from './sequences/factorial'\n\nexport function factorialOf(n: number): number {\n if (n < 0)\n throw new Error('Factorial is not defined for negative numbers')\n\n if (n === 0 || n === 1)\n return 1\n\n if (n <= 18) {\n return factorialNumbers[n]!\n }\n let result = factorialNumbers[18]!\n for (let i = 19; i <= n; i++)\n result *= i\n\n return result\n}\n\nexport const factorialNormalExpressions: BuiltinNormalExpressions = {\n factorial: {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true, lte: 170 })\n return factorialOf(n)\n },\n arity: toFixedArity(1),\n },\n}\n","export const partitionNumbers = [\n 1,\n 2,\n 3,\n 5,\n 7,\n 11,\n 15,\n 22,\n 30,\n 42,\n 56,\n 77,\n 101,\n 135,\n 176,\n 231,\n 297,\n 385,\n 490,\n 627,\n 792,\n 1002,\n 1255,\n 1575,\n 1958,\n 2436,\n 3010,\n 3718,\n 4565,\n 5604,\n 6842,\n 8349,\n 10143,\n 12310,\n 14883,\n 17977,\n 21637,\n 26015,\n 31185,\n 37338,\n 44583,\n 53174,\n 63261,\n 75175,\n 89134,\n 105558,\n 124754,\n 147273,\n 173525,\n 204226,\n 239943,\n 281589,\n 329931,\n 386155,\n 451276,\n 526823,\n 614154,\n 715220,\n 831820,\n 966467,\n 1121505,\n 1300156,\n 1505499,\n 1741630,\n 2012558,\n 2323520,\n 2679689,\n 3087735,\n 3554345,\n 4087968,\n 4697205,\n 5392783,\n 6185689,\n 7089500,\n 8118264,\n 9289091,\n 10619863,\n 12132164,\n 13848650,\n 15796476,\n 18004327,\n 20506255,\n 23338469,\n 26543660,\n 30167357,\n 34262962,\n 38887673,\n 44108109,\n 49995925,\n 56634173,\n 64112359,\n 72533807,\n 82010177,\n 92669720,\n 104651419,\n 118114304,\n 133230930,\n 150198136,\n 169229875,\n 190569292,\n 214481126,\n 241265379,\n 271248950,\n 304801365,\n 342325709,\n 384276336,\n 431149389,\n 483502844,\n 541946240,\n 607163746,\n 679903203,\n 761002156,\n 851376628,\n 952050665,\n 1064144451,\n 1188908248,\n 1327710076,\n 1482074143,\n 1653668665,\n 1844349560,\n 2056148051,\n 2291320912,\n 2552338241,\n 2841940500,\n 3163127352,\n 3519222692,\n 3913864295,\n 4351078600,\n 4835271870,\n 5371315400,\n 5964539504,\n 6620830889,\n 7346629512,\n 8149040695,\n 9035836076,\n 10015581680,\n 11097645016,\n 12292341831,\n 13610949895,\n 15065878135,\n 16670689208,\n 18440293320,\n 20390982757,\n 22540654445,\n 24908858009,\n 27517052599,\n 30388671978,\n 33549419497,\n 37027355200,\n 40853235313,\n 45060624582,\n 49686288421,\n 54770336324,\n 60356673280,\n 66493182097,\n 73232243759,\n 80630964769,\n 88751778802,\n 97662728555,\n 107438159466,\n 118159068427,\n 129913904637,\n 142798995930,\n 156919475295,\n 172389800255,\n 189334822579,\n 207890420102,\n 228204732751,\n 250438925115,\n 274768617130,\n 301384802048,\n 330495499613,\n 362326859895,\n 397125074750,\n 435157697830,\n 476715857290,\n 522115831195,\n 571701605655,\n 625846753120,\n 684957390936,\n 749474411781,\n 819876908323,\n 896684817527,\n 980462880430,\n 1071823774337,\n 1171432692373,\n 1280011042268,\n 1398341745571,\n 1527273599625,\n 1667727404093,\n 1820701100652,\n 1987276856363,\n 2168627105469,\n 2366022741845,\n 2580840212973,\n 2814570987591,\n 3068829878530,\n 3345365983698,\n 3646072432125,\n 3972999029388,\n 4328363658647,\n 4714566886083,\n 5134205287973,\n 5590088317495,\n 6085253859260,\n 6622987708040,\n 7206841706490,\n 7840656226137,\n 8528581302375,\n 9275102575355,\n 10085065885767,\n 10963707205259,\n 11916681236278,\n 12950095925895,\n 14070545699287,\n 15285151248481,\n 16601598107914,\n 18028182516671,\n 19573856161145,\n 21248279009367,\n 23061871173849,\n 25025873760111,\n 27152408925615,\n 29454549941750,\n 31946390696157,\n 34643126322519,\n 37561133582570,\n 40718063627362,\n 44132934884255,\n 47826239745920,\n 51820051838712,\n 56138148670947,\n 60806135438329,\n 65851585970275,\n 71304185514919,\n 77195892663512,\n 83561103925871,\n 90436839668817,\n 97862933703585,\n 105882246722733,\n 114540884553038,\n 123888443077259,\n 133978259344888,\n 144867692496445,\n 156618412527946,\n 169296722391554,\n 182973889854026,\n 197726516681672,\n 213636919820625,\n 230793554364681,\n 249291451168559,\n 269232701252579,\n 290726957916112,\n 313891991306665,\n 338854264248680,\n 365749566870782,\n 394723676655357,\n 425933084409356,\n 459545750448675,\n 495741934760846,\n 534715062908609,\n 576672674947168,\n 621837416509615,\n 670448123060170,\n 722760953690372,\n 779050629562167,\n 839611730366814,\n 904760108316360,\n 974834369944625,\n 1050197489931117,\n 1131238503938606,\n 1218374349844333,\n 1312051800816215,\n 1412749565173450,\n 1520980492851175,\n 1637293969337171,\n 1762278433057269,\n 1896564103591584,\n 2040825852575075,\n 2195786311682516,\n 2362219145337711,\n 2540952590045698,\n 2732873183547535,\n 2938929793929555,\n 3160137867148997,\n 3397584011986773,\n 3652430836071053,\n 3925922161489422,\n 4219388528587095,\n 4534253126900886,\n 4872038056472084,\n 5234371069753672,\n 5622992691950605,\n 6039763882095515,\n 6486674127079088,\n 6965850144195831,\n 7479565078510584,\n 8030248384943040,\n 8620496275465025,\n]\n","import { LitsError } from '../../../errors'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { partitionNumbers } from './sequences/partition'\n\nfunction partitions(n: number): number[][] {\n // Base cases\n if (n <= 0)\n return [[]]\n if (n === 1)\n return [[1]]\n\n const result: number[][] = []\n\n // Helper function to generate partitions recursively\n function generatePartitions(remaining: number, max: number, current: number[]): void {\n if (remaining === 0) {\n result.push([...current])\n return\n }\n\n // Try all possible numbers from 1 up to max\n for (let i = Math.min(max, remaining); i >= 1; i--) {\n current.push(i)\n generatePartitions(remaining - i, i, current)\n current.pop()\n }\n }\n\n generatePartitions(n, n, [])\n return result\n}\n\nexport const partitionsNormalExpressions: BuiltinNormalExpressions = {\n 'partitions': {\n evaluate: ([n], sourceCodeInfo): number[][] => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n return partitions(n)\n },\n arity: toFixedArity(1),\n },\n 'count-partitions': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n === 0)\n return 1\n\n if (n > partitionNumbers.length) {\n throw new LitsError(`n is too large. The maximum value is ${partitionNumbers.length - 1}.`, sourceCodeInfo)\n }\n\n return partitionNumbers[n - 1]!\n },\n arity: toFixedArity(1),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport { factorialOf } from './factorial'\n\n/**\n * Generates all possible permutations of a collection.\n * @param collection The input collection to generate permutations from\n * @returns An array of arrays, where each inner array is a permutation of the input collection\n */\nfunction permutations<T>(collection: T[]): T[][] {\n // Base case: empty array has one permutation - itself\n if (collection.length === 0) {\n return [[]]\n }\n\n const result: T[][] = []\n\n // For each element in the array\n for (let i = 0; i < collection.length; i++) {\n // Extract the current element\n const current = collection[i]!\n\n // Create a new array without the current element\n const remainingElements = [...collection.slice(0, i), ...collection.slice(i + 1)]\n\n // Generate all permutations of the remaining elements\n const subPermutations = permutations(remainingElements)\n\n // Add the current element to the beginning of each sub-permutation\n for (const subPerm of subPermutations) {\n result.push([current, ...subPerm])\n }\n }\n\n return result\n}\n\nexport const permutationsNormalExpressions: BuiltinNormalExpressions = {\n 'permutations': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return permutations(set)\n },\n arity: toFixedArity(1),\n },\n 'count-permutations': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n assertNumber(k, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return factorialOf(n) / factorialOf(n - k)\n },\n arity: toFixedArity(2),\n },\n}\n","import type { Arr } from '../../../interface'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\nfunction powerSet(set: Arr): Arr[] {\n const result: Arr[] = [[]]\n\n for (const value of set) {\n const newSubsets = result.map(subset => [...subset, value])\n result.push(...newSubsets)\n }\n\n return result\n}\n\nexport const powerSetNormalExpressions: BuiltinNormalExpressions = {\n 'power-set': {\n evaluate: ([set], sourceCodeInfo): Arr[] => {\n assertArray(set, sourceCodeInfo)\n return powerSet(set)\n },\n arity: toFixedArity(1),\n },\n 'count-power-set': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, nonNegative: true })\n if (n >= 53) {\n // Number.MAX_SAFE_INTEGER is 2^53 - 1\n return Infinity\n }\n\n return 2 ** n\n },\n arity: toFixedArity(1),\n },\n}\n","import { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\n\n/**\n * Returns the prime factorization of a number as an array of its prime factors.\n * For example, factors(12) returns [2, 2, 3].\n * Special case: factors(1) returns an empty array [].\n *\n * @param n - A positive integer to factorize\n * @returns An array of prime factors in ascending order\n */\nexport function primeFactors(n: number): number[] {\n // Special case: 1 has no prime factors\n if (n === 1) {\n return []\n }\n\n const factors: number[] = []\n let divisor = 2\n\n // Find factors by trial division\n while (n > 1) {\n // If divisor divides n evenly\n if (n % divisor === 0) {\n // Add divisor to the factors list\n factors.push(divisor)\n // Divide n by the found factor\n n /= divisor\n }\n else {\n // Move to the next potential divisor\n divisor++\n }\n }\n\n return factors\n}\n\nexport const primeFactorsNormalExpressions: BuiltinNormalExpressions = {\n 'prime-factors': {\n evaluate: ([number], sourceCodeInfo): number[] => {\n assertNumber(number, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(number)\n },\n arity: toFixedArity(1),\n },\n 'distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number[] => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return Array.from(distinctFactors)\n },\n arity: toFixedArity(1),\n },\n 'count-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n return primeFactors(n).length\n },\n arity: toFixedArity(1),\n },\n 'count-distinct-prime-factors': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { finite: true, integer: true, positive: true })\n const factors = primeFactors(n)\n const distinctFactors = new Set(factors)\n return distinctFactors.size\n },\n arity: toFixedArity(1),\n },\n}\n","/**\n * MaybePromise utilities for transparent async support.\n *\n * The sync path stays zero-overhead — when no async JS functions are involved,\n * everything runs synchronously with only `instanceof Promise` checks as overhead.\n * When an async value is detected, the evaluation chain switches to Promise-based\n * execution for the remainder.\n */\n\nexport type MaybePromise<T> = T | Promise<T>\n\n/**\n * Chain a value that might be a Promise. If the value is sync, calls fn synchronously.\n * If it's a Promise, chains with .then().\n */\nexport function chain<T, U>(value: MaybePromise<T>, fn: (v: T) => MaybePromise<U>): MaybePromise<U> {\n if (value instanceof Promise) {\n return value.then(fn)\n }\n return fn(value)\n}\n\n/**\n * Like Array.map but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function mapSequential<T, U>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<U>,\n): MaybePromise<U[]> {\n const results: U[] = []\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingMap(result, results, arr, fn, i)\n }\n results.push(result)\n }\n return results\n}\n\nasync function chainRemainingMap<T, U>(\n currentPromise: Promise<U>,\n results: U[],\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<U>,\n startIndex: number,\n): Promise<U[]> {\n results.push(await currentPromise)\n for (let i = startIndex + 1; i < arr.length; i++) {\n results.push(await fn(arr[i]!, i))\n }\n return results\n}\n\n/**\n * Like Array.reduce but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function reduceSequential<T, U>(\n arr: readonly T[],\n fn: (acc: U, elem: T, index: number) => MaybePromise<U>,\n initial: U,\n): MaybePromise<U> {\n let result: U = initial\n for (let i = 0; i < arr.length; i++) {\n const next = fn(result, arr[i]!, i)\n if (next instanceof Promise) {\n return chainRemainingReduce(next, arr, fn, i)\n }\n result = next\n }\n return result\n}\n\nasync function chainRemainingReduce<T, U>(\n currentPromise: Promise<U>,\n arr: readonly T[],\n fn: (acc: U, elem: T, index: number) => MaybePromise<U>,\n startIndex: number,\n): Promise<U> {\n let result = await currentPromise\n for (let i = startIndex + 1; i < arr.length; i++) {\n result = await fn(result, arr[i]!, i)\n }\n return result\n}\n\n/**\n * Like Array.forEach but handles MaybePromise callbacks sequentially.\n * In the sync case, runs as a simple loop. Switches to async only when needed.\n */\nexport function forEachSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<void>,\n): MaybePromise<void> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingForEach(result, arr, fn, i)\n }\n }\n}\n\nasync function chainRemainingForEach<T>(\n currentPromise: Promise<void>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<void>,\n startIndex: number,\n): Promise<void> {\n await currentPromise\n for (let i = startIndex + 1; i < arr.length; i++) {\n await fn(arr[i]!, i)\n }\n}\n\n/**\n * Try/catch that handles MaybePromise values correctly.\n * If tryFn returns a Promise, catches both sync throws and Promise rejections.\n */\nexport function tryCatch<T>(\n tryFn: () => MaybePromise<T>,\n catchFn: (error: unknown) => MaybePromise<T>,\n): MaybePromise<T> {\n try {\n const result = tryFn()\n if (result instanceof Promise) {\n return result.catch(catchFn)\n }\n return result\n }\n catch (error) {\n return catchFn(error)\n }\n}\n\n/**\n * Like Array.some but handles MaybePromise callbacks sequentially.\n * Returns the first truthy MaybePromise result, or false.\n */\nexport function someSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<boolean> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingSome(result, arr, fn, i)\n }\n if (result)\n return true\n }\n return false\n}\n\nasync function chainRemainingSome<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<boolean> {\n if (await currentPromise)\n return true\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n return true\n }\n return false\n}\n\n/**\n * Like Array.every but handles MaybePromise callbacks sequentially.\n * Returns false as soon as a falsy result is found.\n */\nexport function everySequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<boolean> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingEvery(result, arr, fn, i)\n }\n if (!result)\n return false\n }\n return true\n}\n\nasync function chainRemainingEvery<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<boolean> {\n if (!await currentPromise)\n return false\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (!await fn(arr[i]!, i))\n return false\n }\n return true\n}\n\n/**\n * Like Array.filter but handles MaybePromise callbacks sequentially.\n * Returns the filtered array.\n */\nexport function filterSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<T[]> {\n const results: T[] = []\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingFilter(result, results, arr, fn, i)\n }\n if (result)\n results.push(arr[i]!)\n }\n return results\n}\n\nasync function chainRemainingFilter<T>(\n currentPromise: Promise<unknown>,\n results: T[],\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<T[]> {\n if (await currentPromise)\n results.push(arr[startIndex]!)\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n results.push(arr[i]!)\n }\n return results\n}\n\n/**\n * Like Array.findIndex but handles MaybePromise callbacks sequentially.\n * Returns -1 if no element matches.\n */\nexport function findIndexSequential<T>(\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n): MaybePromise<number> {\n for (let i = 0; i < arr.length; i++) {\n const result = fn(arr[i]!, i)\n if (result instanceof Promise) {\n return chainRemainingFindIndex(result, arr, fn, i)\n }\n if (result)\n return i\n }\n return -1\n}\n\nasync function chainRemainingFindIndex<T>(\n currentPromise: Promise<unknown>,\n arr: readonly T[],\n fn: (elem: T, index: number) => MaybePromise<unknown>,\n startIndex: number,\n): Promise<number> {\n if (await currentPromise)\n return startIndex\n for (let i = startIndex + 1; i < arr.length; i++) {\n if (await fn(arr[i]!, i))\n return i\n }\n return -1\n}\n","import { getProperDivisors } from '../divisors'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nfunction isAbundant(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum > num\n}\n\nexport const abundantSequence: SequenceDefinition<'abundant'> = {\n 'abundant-seq': (length) => {\n const abundants = []\n let num = 2\n while (abundants.length < length) {\n if (isAbundant(num)) {\n abundants.push(num)\n }\n num += 1\n }\n return abundants\n },\n 'abundant?': n => isAbundant(n),\n 'abundant-take-while': (takeWhile) => {\n const abundants: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!isAbundant(i))\n return loop(i + 1)\n return chain(takeWhile(i, abundants.length), (keep) => {\n if (!keep)\n return abundants\n abundants.push(i)\n return loop(i + 1)\n })\n }\n return loop(2)\n },\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/lits'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { LitsError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new LitsError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of an arithmetic sequence.\n * @param start The first term of the sequence\n * @param step The common difference between terms\n * @param n The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInArithmeticSequence(\n start: number,\n step: number,\n n: number,\n): boolean {\n // Special case: If step is 0, n must equal start\n if (step === 0) {\n return approxEqual(n, start)\n }\n\n // Calculate position in sequence\n const position = (n - start) / step\n\n // Position must be non-negative\n if (position < 0) {\n return false\n }\n\n // Find nearest integer position\n const roundedPosition = Math.round(position)\n\n // Calculate the value at that position\n const calculatedValue = start + step * roundedPosition\n\n // Check both if position is close to an integer and if the\n // calculated value is close to the input value\n return approxEqual(position, roundedPosition) && approxEqual(calculatedValue, n)\n}\n\nexport const arithmeticNormalExpressions: SequenceNormalExpressions<'arithmetic'> = {\n 'arithmetic-seq': {\n evaluate: ([start, step, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start + i * step)\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-take-while': {\n evaluate: ([start, step, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n const s = start\n const d = step\n const f = fn\n\n const arithmetic: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = s + i * d\n return chain(executeFunction(f, [value, i], contextStack, sourceCodeInfo), (keep) => {\n if (!keep)\n return arithmetic\n arithmetic.push(value)\n return loop(i + 1)\n })\n }\n return loop(0)\n },\n arity: toFixedArity(3),\n },\n 'arithmetic-nth': {\n evaluate: ([start, step, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start + (n - 1) * step\n },\n arity: toFixedArity(3),\n },\n 'arithmetic?': {\n evaluate: ([start, step, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(step, sourceCodeInfo, { finite: true })\n\n return isInArithmeticSequence(start, step, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { binomialCoefficient } from '../binomialCefficient'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceNormalExpressions } from '.'\n\nfunction getBernoulliSeq(length: number): number[] {\n const bernoulli = [1]\n for (let n = 1; n < length; n += 1) {\n let sum = 0\n for (let k = 0; k < n; k += 1) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n bernoulli[n] = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n }\n return bernoulli\n}\n\n/**\n * Generates Bernoulli numbers as long as the predicate function returns true\n * @param predicate - Function that takes a Bernoulli number and its index and returns true if generation should continue\n * @returns Array of Bernoulli numbers generated until predicate returns false\n */\nfunction generateBernoulli(\n predicate: (value: number, index: number) => MaybePromise<boolean>,\n): MaybePromise<number[]> {\n const bernoulli: number[] = [1]\n\n function loop(n: number): MaybePromise<number[]> {\n let sum = 0\n for (let k = 0; k < n; k++) {\n sum += binomialCoefficient(n + 1, k) * bernoulli[k]!\n }\n\n const newValue = n > 1 && n % 2 === 1 ? 0 : -sum / (n + 1)\n\n return chain(predicate(newValue, n), (keep) => {\n if (!keep)\n return bernoulli\n bernoulli.push(newValue)\n return loop(n + 1)\n })\n }\n\n return loop(1)\n}\n\nexport const bernoulliNormalExpressions: Omit<SequenceNormalExpressions<'bernoulli'>, 'bernoulli?'> = {\n 'bernoulli-seq': {\n evaluate: ([length], sourceCodeInfo): number[] => {\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n return getBernoulliSeq(length)\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-nth': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const bernoulli = getBernoulliSeq(n)\n return bernoulli[n - 1]!\n },\n arity: toFixedArity(1),\n },\n 'bernoulli-take-while': {\n evaluate: ([fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertFunctionLike(fn, sourceCodeInfo)\n const f = fn\n return generateBernoulli((value, index) => chain(executeFunction(f, [value, index], contextStack), val => !!val))\n },\n arity: toFixedArity(1),\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nexport function isPrime(num: number): boolean {\n if (num <= 1) {\n return false\n }\n if (num <= 3) {\n return true\n }\n if (num % 2 === 0 || num % 3 === 0) {\n return false\n }\n\n for (let i = 5; i * i <= num; i += 6) {\n if (num % i === 0 || num % (i + 2) === 0) {\n return false\n }\n }\n return true\n}\n\nexport const primeSequence: SequenceDefinition<'prime'> = {\n 'prime-seq': (length) => {\n const primes = []\n let num = 2\n while (primes.length < length) {\n if (isPrime(num)) {\n primes.push(num)\n }\n num += 1\n }\n return primes\n },\n 'prime?': n => isPrime(n),\n 'prime-take-while': (takeWhile) => {\n const primes: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!isPrime(i))\n return loop(i + 1)\n return chain(takeWhile(i, primes.length), (keep) => {\n if (!keep)\n return primes\n primes.push(i)\n return loop(i + 1)\n })\n }\n return loop(2)\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport { isPrime } from './prime'\nimport type { SequenceDefinition } from '.'\n\nexport function isComposite(num: number): boolean {\n if (num <= 1) {\n return false\n }\n return !isPrime(num)\n}\n\nexport const compositeSequence: SequenceDefinition<'composite'> = {\n 'composite-seq': (length) => {\n const composites = []\n let num = 2\n while (composites.length < length) {\n if (isComposite(num)) {\n composites.push(num)\n }\n num += 1\n }\n return composites\n },\n 'composite?': n => isComposite(n),\n 'composite-take-while': (takeWhile) => {\n const composites: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!isComposite(i))\n return loop(i + 1)\n return chain(takeWhile(i, composites.length), (keep) => {\n if (!keep)\n return composites\n composites.push(i)\n return loop(i + 1)\n })\n }\n return loop(4)\n },\n}\n","import { getProperDivisors } from '../divisors'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nfunction isDeficient(num: number): boolean {\n const properDivisors = getProperDivisors(num)\n const sum = properDivisors.reduce((acc, curr) => acc + curr, 0)\n return sum < num\n}\n\nexport const deficientSequence: SequenceDefinition<'deficient'> = {\n 'deficient-seq': (length) => {\n const deficients = []\n let num = 1\n while (deficients.length < length) {\n if (isDeficient(num)) {\n deficients.push(num)\n }\n num += 1\n }\n return deficients\n },\n 'deficient?': n => isDeficient(n),\n 'deficient-take-while': (takeWhile) => {\n const deficients: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!isDeficient(i))\n return loop(i + 1)\n return chain(takeWhile(i, deficients.length), (keep) => {\n if (!keep)\n return deficients\n deficients.push(i)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { approxEqual } from '../../../../utils'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceNormalExpressions } from '.'\n\n/**\n * Checks if a number is a member of a geometric sequence.\n * @param initialTerm The first term of the sequence (a)\n * @param ratio The common ratio of the sequence (r)\n * @param number The number to check\n * @returns true if the number is in the sequence, false otherwise\n */\nfunction isInGeometricSequence(\n initialTerm: number,\n ratio: number,\n number: number,\n): boolean {\n // Handle special cases\n if (approxEqual(initialTerm, 0)) {\n return approxEqual(number, 0)\n }\n if (approxEqual(ratio, 1)) {\n return approxEqual(number, initialTerm)\n }\n if (approxEqual(ratio, 0)) {\n return approxEqual(number, 0) || approxEqual(number, initialTerm)\n }\n\n // Check if the number is exactly the initial term\n if (approxEqual(number, initialTerm)) {\n return true\n }\n\n // Special case for ratio = -1 (alternating sequence)\n if (approxEqual(ratio, -1)) {\n // In an alternating sequence with ratio -1, the terms are just initialTerm and -initialTerm\n return approxEqual(number, initialTerm) || approxEqual(number, -initialTerm)\n }\n\n // For negative ratios, we need special handling\n if (ratio < 0) {\n // Calculate log using absolute values\n const logResult = Math.log(Math.abs(number / initialTerm)) / Math.log(Math.abs(ratio))\n\n // Check if logResult is very close to an integer\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // For negative ratios, alternating terms have alternating signs\n // Check if sign matches what we expect based on the power\n const expectedSign = roundedLogResult % 2 === 0\n ? Math.sign(initialTerm)\n : Math.sign(initialTerm) * Math.sign(ratio)\n\n return Math.sign(number) === expectedSign\n }\n\n // For positive ratios\n\n // Quick check based on sequence direction\n if ((ratio > 1 && number < initialTerm) || (ratio < 1 && number > initialTerm)) {\n return false\n }\n\n // Calculate n in: number = initialTerm * (ratio^n)\n const logResult = Math.log(number / initialTerm) / Math.log(ratio)\n\n // Check if logResult is very close to an integer and non-negative\n const roundedLogResult = Math.round(logResult)\n if (!approxEqual(roundedLogResult, logResult) || roundedLogResult < 0) {\n return false\n }\n\n // Verify calculated value matches the number exactly\n const calculatedValue = initialTerm * ratio ** roundedLogResult\n\n return approxEqual(calculatedValue, number)\n}\nexport const geometricNormalExpressions: SequenceNormalExpressions<'geometric'> = {\n 'geometric-seq': {\n evaluate: ([start, ratio, length], sourceCodeInfo): number[] => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true })\n\n return Array.from({ length }, (_, i) => start * ratio ** i)\n },\n arity: toFixedArity(3),\n },\n 'geometric-take-while': {\n evaluate: ([start, ratio, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertFunctionLike(fn, sourceCodeInfo)\n const s = start\n const r = ratio\n const f = fn\n\n const geometric: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = s * r ** i\n return chain(executeFunction(f, [value, i], contextStack, sourceCodeInfo), (keep) => {\n if (!keep)\n return geometric\n geometric.push(value)\n return loop(i + 1)\n })\n }\n return loop(0)\n },\n arity: toFixedArity(3),\n },\n 'geometric-nth': {\n evaluate: ([start, ratio, n], sourceCodeInfo): number => {\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return start * ratio ** (n - 1)\n },\n arity: toFixedArity(3),\n },\n 'geometric?': {\n evaluate: ([start, ratio, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo)\n assertNumber(start, sourceCodeInfo, { finite: true })\n assertNumber(ratio, sourceCodeInfo, { finite: true })\n\n return isInGeometricSequence(start, ratio, n)\n },\n arity: toFixedArity(3),\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nfunction getGolombSeq(n: number): number[] {\n const golomb = [0, 1]\n for (let i = 2; i <= n; i += 1) {\n golomb.push(1 + golomb[i - golomb[golomb[i - 1]!]!]!)\n }\n return golomb.slice(1)\n}\n\nfunction generateGolombSeq(pred: (golombNumber: number, index: number) => MaybePromise<boolean>): MaybePromise<number[]> {\n const golomb = [0, 1]\n return chain(pred(1, 0), (keepFirst) => {\n if (!keepFirst)\n return []\n function loop(i: number): MaybePromise<number[]> {\n const golombNumber = 1 + golomb[i - golomb[golomb[i - 1]!]!]!\n return chain(pred(golombNumber, i - 1), (keep) => {\n if (!keep)\n return golomb.slice(1)\n golomb.push(golombNumber)\n return loop(i + 1)\n })\n }\n return loop(2)\n })\n}\n\nexport const golombSequence: SequenceDefinition<'golomb'> = {\n 'golomb-seq': length => getGolombSeq(length),\n 'golomb?': () => true,\n 'golomb-take-while': takeWhile => generateGolombSeq(takeWhile),\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nfunction isHappyNumber(n: number): boolean {\n // A happy number is defined by the following process:\n // 1. Starting with any positive integer, replace the number by the sum of the squares of its digits\n // 2. Repeat until either:\n // - The number equals 1 (in which case it's a happy number)\n // - It enters a cycle that doesn't include 1 (in which case it's not a happy number)\n\n if (n <= 0)\n return false\n\n // Use a set to detect cycles\n const seen = new Set()\n\n // Continue until we either reach 1 or detect a cycle\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = getSumOfSquaredDigits(n)\n }\n\n // If we reached 1, it's a happy number\n return n === 1\n}\n\nfunction getSumOfSquaredDigits(n: number): number {\n let sum = 0\n\n while (n > 0) {\n const digit = n % 10\n sum += digit * digit\n n = Math.floor(n / 10)\n }\n\n return sum\n}\n\nexport const happySequence: SequenceDefinition<'happy'> = {\n 'happy-seq': (length) => {\n const happyNumbers: number[] = []\n for (let i = 1; happyNumbers.length < length; i++) {\n let n = i\n const seen = new Set<number>()\n while (n !== 1 && !seen.has(n)) {\n seen.add(n)\n n = String(n)\n .split('')\n .reduce((sum, digit) => sum + Number(digit) ** 2, 0)\n }\n if (n === 1)\n happyNumbers.push(i)\n }\n return happyNumbers\n },\n 'happy?': n => isHappyNumber(n),\n 'happy-take-while': (takeWhile) => {\n const happyNumbers: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!isHappyNumber(i))\n return loop(i + 1)\n return chain(takeWhile(i, happyNumbers.length), (keep) => {\n if (!keep)\n return happyNumbers\n happyNumbers.push(i)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n}\n","import type { SequenceDefinition } from '.'\n\nexport const jugglerSequence: Omit<SequenceDefinition<'juggler'>, 'juggler-nth' | 'juggler-take-while' | 'juggler?'> = {\n 'juggler-seq': (start) => {\n let next = start\n const juggler = [next]\n\n while (next > 1) {\n next = next % 2 === 0\n ? Math.floor(Math.sqrt(next))\n : Math.floor(next ** (3 / 2))\n juggler.push(next)\n }\n return juggler\n },\n 'noNth': true,\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is part of the Look-and-Say sequence.\n *\n * The Look-and-Say sequence starts with \"1\" and each subsequent term describes\n * the previous term by counting consecutive digits. For example:\n * 1, 11, 21, 1211, 111221, 312211, 13112221, ...\n *\n * @param {string|number} target - The number to check (can be a string or number)\n * @returns {boolean} - Whether the target is in the sequence\n */\nfunction isLookAndSay(target: string): boolean {\n // The first term of the sequence\n let current = '1'\n\n // Check if the first term matches\n if (current === target) {\n return true\n }\n\n // Generate terms and check against the target\n while (true) {\n current = getNextLookAndSayTerm(current)\n\n if (current === target) {\n return true\n }\n\n // Optimization: if the current term is longer than the target, and\n // the sequence is strictly increasing in length, the target won't be found\n if (current.length > target.length) {\n return false\n }\n }\n}\n\n/**\n * Generates the next term in the Look-and-Say sequence\n *\n * @param {string} term - The current term\n * @returns {string} - The next term in the sequence\n */\nfunction getNextLookAndSayTerm(term: string): string {\n let result = ''\n let count = 1\n\n for (let i = 0; i < term.length; i++) {\n // If the current digit is the same as the next one, increment count\n if (i + 1 < term.length && term[i] === term[i + 1]) {\n count++\n }\n else {\n // Otherwise, append count and the digit to the result\n result += count.toString() + term[i]\n count = 1\n }\n }\n\n return result\n}\n\nexport const lookAndSaySequence: SequenceDefinition<'look-and-say', string> = {\n 'string': true,\n 'look-and-say-seq': (length) => {\n const lookAndSay = ['1']\n for (let i = 1; i < length; i += 1) {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n lookAndSay[i] = next\n }\n return lookAndSay\n },\n 'look-and-say-take-while': (takeWhile) => {\n const lookAndSay: string[] = []\n return chain(takeWhile('1', 0), (keepFirst) => {\n if (!keepFirst)\n return lookAndSay\n lookAndSay.push('1')\n function loop(i: number): MaybePromise<string[]> {\n const prev = lookAndSay[i - 1]!\n const next = prev.replace(/(\\d)\\1*/g, match => `${match.length}${match[0]}`)\n return chain(takeWhile(next, i), (keep) => {\n if (!keep)\n return lookAndSay\n lookAndSay.push(next)\n return loop(i + 1)\n })\n }\n return loop(1)\n })\n },\n 'look-and-say?': n => isLookAndSay(n),\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Generates lucky numbers while the predicate function returns true.\n *\n * @param predicate - Function that tests if we should continue generating numbers.\n * Takes the current lucky number and index as parameters.\n * @returns An array of lucky numbers\n */\nfunction generateLuckyNumbers(\n predicate: (luckyNumber: number, index: number) => MaybePromise<boolean>,\n): MaybePromise<number[]> {\n // Start with counting from 1\n const numbers: number[] = []\n for (let i = 1; i <= 2000; i++) {\n numbers.push(i)\n }\n\n // First step: remove all even numbers (keep 1)\n let filteredNumbers: number[] = [1]\n for (let i = 1; i < numbers.length; i++) {\n if (numbers[i]! % 2 !== 0) {\n filteredNumbers.push(numbers[i]!)\n }\n }\n\n const luckyNumbers: number[] = [1] // 1 is always the first lucky number\n let count = 1\n\n // Check if we should continue after the first number\n return chain(predicate(1, 0), (keepFirst) => {\n if (!keepFirst)\n return []\n\n // Continue the sieve process\n let index = 1 // Start with the second element (index 1, which is 3)\n\n function loop(): MaybePromise<number[]> {\n // Get the current lucky number\n const luckyNumber = filteredNumbers[index]!\n\n // Check if we should continue\n return chain(predicate(luckyNumber, count), (keep) => {\n if (!keep)\n return luckyNumbers\n\n // Add to result\n luckyNumbers.push(luckyNumber)\n count++\n\n // Apply the sieve\n const step = luckyNumber\n const newFiltered: number[] = []\n\n for (let i = 0; i < filteredNumbers.length; i++) {\n if ((i + 1) % step !== 0) { // Keep numbers not at positions divisible by step\n newFiltered.push(filteredNumbers[i]!)\n }\n }\n\n filteredNumbers = newFiltered\n index++\n\n // If we're running low on numbers, extend the sequence\n if (index >= filteredNumbers.length - 5) {\n const lastNum = filteredNumbers[filteredNumbers.length - 1]!\n let next = lastNum + 2\n\n while (filteredNumbers.length < index + 1000) {\n filteredNumbers.push(next)\n next += 2\n }\n }\n\n return loop()\n })\n }\n\n return loop()\n })\n}\n\n/**\n * Generates lucky numbers up to a specified length or count\n *\n * Lucky numbers are a subset of integers defined by a specific sieving process:\n * 1. Start with all positive integers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...\n * 2. Keep 1, delete every 2nd number: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, ...\n * 3. The second remaining number is 3, so keep it and delete every 3rd number: 1, 3, 7, 9, 13, 15, 19, ...\n * 4. The third remaining number is 7, so keep it and delete every 7th number\n * 5. Continue this process to get all lucky numbers\n *\n * @param count - The number of lucky numbers to generate\n * @returns An array containing the first 'count' lucky numbers\n */\nfunction getLuckyNumbers(count: number): number[] {\n // Step 1: Start with all odd numbers (we skip the first elimination step since we know\n // the first sieve removes all even numbers)\n const numbers: number[] = []\n let n = 1\n // Generate enough odd numbers to ensure we'll have 'count' lucky numbers after sieving\n // The factor depends on how many numbers we expect to be eliminated\n // For larger counts, we need a higher factor to ensure we have enough numbers\n const factor = count < 100 ? 20 : 30\n const initialSize = count * factor\n\n while (numbers.length < initialSize) {\n numbers.push(n)\n n += 2\n }\n\n // Step 2 and beyond: Apply the lucky number sieve\n let sieveIndex = 1 // Start at index 1 (the second element which is 3)\n\n while (sieveIndex < numbers.length && sieveIndex < count) {\n const sieveValue = numbers[sieveIndex]!\n\n // Remove every sieveValue-th number\n // This is an optimization over creating a new array each time\n let j = 0\n for (let i = 0; i < numbers.length; i++) {\n if ((i + 1) % sieveValue !== 0) {\n numbers[j++] = numbers[i]!\n }\n }\n numbers.length = j // Truncate the array\n\n // Only increment sieveIndex if it's still within the new array bounds\n if (sieveIndex < numbers.length) {\n sieveIndex++\n }\n }\n\n // Return the requested number of lucky numbers\n return numbers.slice(0, count)\n}\n\nexport const luckySequence: SequenceDefinition<'lucky'> = {\n 'lucky-seq': length => getLuckyNumbers(length),\n 'lucky?': n => (generateLuckyNumbers(l => l <= n) as number[]).includes(n),\n 'lucky-take-while': takeWhile => generateLuckyNumbers(takeWhile),\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a Padovan number.\n * Padovan numbers follow the recurrence relation: P(n) = P(n-2) + P(n-3) for n >= 3,\n * with initial values P(0) = P(1) = P(2) = 1.\n *\n * The first few Padovan numbers are:\n * 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49, 65, 86, 114, 151, 200, ...\n *\n * @param num - The number to check\n * @returns True if the number is a Padovan number, false otherwise\n */\nfunction isPadovan(num: number): boolean {\n // Padovan numbers are always positive integers\n if (!Number.isInteger(num) || num <= 0) {\n return false\n }\n\n // Special case: The first three Padovan numbers are all 1\n if (num === 1) {\n return true\n }\n\n // Pre-calculated Padovan numbers (for efficient lookup, verified for correctness)\n const padovanNumbers = [\n 1,\n 1,\n 1,\n 2,\n 2,\n 3,\n 4,\n 5,\n 7,\n 9,\n 12,\n 16,\n 21,\n 28,\n 37,\n 49,\n 65,\n 86,\n 114,\n 151,\n 200,\n 265,\n 351,\n 465,\n 616,\n 816,\n 1081,\n 1432,\n 1897,\n 2513,\n 3329,\n 4410,\n 5842,\n 7739,\n 10252,\n 13581,\n 17991,\n 23833,\n 31572,\n 41824,\n 55405,\n 73396,\n 97229,\n ]\n\n // Direct lookup for known values\n if (padovanNumbers.includes(num)) {\n return true\n }\n\n // For numbers larger than our pre-calculated list but within JavaScript's safe range\n if (num > padovanNumbers[padovanNumbers.length - 1]! && num <= Number.MAX_SAFE_INTEGER) {\n // Start with the last three values from our known sequence\n let a = padovanNumbers[padovanNumbers.length - 3]!\n let b = padovanNumbers[padovanNumbers.length - 2]!\n let c = padovanNumbers[padovanNumbers.length - 1]!\n let next\n\n // Generate Padovan numbers until we either find a match or exceed the input\n while (c < num) {\n next = a + b\n a = b\n b = c\n c = next\n\n if (c === num) {\n return true\n }\n\n // Check for numeric overflow/precision issues\n if (!Number.isSafeInteger(c)) {\n return false\n }\n }\n }\n\n return false\n}\n\nexport const padovanSequence: SequenceDefinition<'padovan'> = {\n 'padovan-seq': (length) => {\n const padovan = [1, 1, 1]\n for (let i = 3; i < length; i += 1) {\n padovan[i] = padovan[i - 2]! + padovan[i - 3]!\n }\n return padovan.slice(0, length)\n },\n 'padovan?': n => isPadovan(n),\n 'padovan-take-while': (takeWhile) => {\n const padovan: number[] = []\n return chain(takeWhile(1, 0), (keep0) => {\n if (!keep0)\n return padovan\n padovan.push(1)\n return chain(takeWhile(1, 1), (keep1) => {\n if (!keep1)\n return padovan\n padovan.push(1)\n return chain(takeWhile(1, 2), (keep2) => {\n if (!keep2)\n return padovan\n padovan.push(1)\n let a = 1\n let b = 1\n let c = 1\n function loop(i: number): MaybePromise<number[]> {\n const temp = a + b\n a = b\n b = c\n c = temp\n return chain(takeWhile(c, i), (keep) => {\n if (!keep)\n return padovan\n padovan.push(c)\n return loop(i + 1)\n })\n }\n return loop(4)\n })\n })\n })\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nexport const perfectCubeSequence: SequenceDefinition<'perfect-cube'> = {\n 'perfect-cube-seq': (length) => {\n const perfectcubes = []\n for (let i = 1; i <= length; i++) {\n perfectcubes.push(i ** 3)\n }\n return perfectcubes\n },\n 'perfect-cube?': n => n > 0 && Number.isInteger(Math.cbrt(n)),\n 'perfect-cube-take-while': (takeWhile) => {\n const perfectcubes: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = i ** 3\n return chain(takeWhile(value, i), (keep) => {\n if (!keep)\n return perfectcubes\n perfectcubes.push(value)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n}\n","import { approxEqual } from '../../../../utils'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Checks if a number is a perfect power and returns the base and exponent if it is.\n * A perfect power is a number that can be expressed as an integer power of another integer.\n *\n * @param n - The number to check\n * @returns [base, exponent] if n is a perfect power, null otherwise\n */\nexport function perfectPower(n: number): [number, number] | null {\n // Handle edge cases\n if (n < 2) {\n if (n === 1) {\n // 1 is 1^k for any k, we return [1, 2] as the simplest representation\n return [1, 2]\n }\n return null // Non positive numbers are not perfect powers\n }\n\n // For each possible exponent k, try to find base b such that b^k = n\n const maxK = Math.floor(Math.log2(n)) + 1\n\n for (let k = 2; k <= maxK; k++) {\n // Calculate the potential base as n^(1/k)\n const b = n ** (1 / k)\n const roundedB = Math.round(b)\n\n if (approxEqual(roundedB ** k, n)) {\n return [roundedB, k]\n }\n }\n\n return null // Not a perfect power\n}\n\nexport const perfectPowerSequence: SequenceDefinition<'perfect-power'> = {\n 'perfect-power-seq': (length) => {\n const perfectPowers: number[] = []\n for (let i = 1; perfectPowers.length < length; i++) {\n if (perfectPower(i)) {\n perfectPowers.push(i)\n }\n }\n return perfectPowers\n },\n 'perfect-power?': n => perfectPower(n) !== null,\n 'perfect-power-take-while': (takeWhile) => {\n const perfectPowers: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n if (!perfectPower(i))\n return loop(i + 1)\n return chain(takeWhile(i, perfectPowers.length), (keep) => {\n if (!keep)\n return perfectPowers\n perfectPowers.push(i)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nexport const perfectSquareSequence: SequenceDefinition<'perfect-square'> = {\n 'perfect-square-seq': (length) => {\n const perfectSquares = []\n for (let i = 1; i <= length; i++) {\n perfectSquares.push(i ** 2)\n }\n return perfectSquares\n },\n 'perfect-square?': n => n > 0 && Number.isInteger(Math.sqrt(n)),\n 'perfect-square-take-while': (takeWhile) => {\n const perfectSquares: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = i ** 2\n return chain(takeWhile(value, i), (keep) => {\n if (!keep)\n return perfectSquares\n perfectSquares.push(value)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n}\n","import { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceNormalExpressions } from '.'\n\nexport const poligonalNormalExpressions: SequenceNormalExpressions<'polygonal'> = {\n 'polygonal-seq': {\n evaluate: ([sides, n], sourceCodeInfo): number[] => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n\n const polygonal = []\n for (let i = 1; i <= n; i += 1) {\n polygonal[i - 1] = (i * i * (sides - 2) - i * (sides - 4)) / 2\n }\n return polygonal\n },\n arity: toFixedArity(2),\n },\n 'polygonal-take-while': {\n evaluate: ([sides, fn], sourceCodeInfo, contextStack, { executeFunction }) => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertFunctionLike(fn, sourceCodeInfo)\n const s = sides\n const f = fn\n\n const polygonal: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = (i * i * (s - 2) - i * (s - 4)) / 2\n return chain(executeFunction(f, [value, i], contextStack, sourceCodeInfo), (keep) => {\n if (!keep)\n return polygonal\n polygonal.push(value)\n return loop(i + 1)\n })\n }\n return loop(1)\n },\n arity: toFixedArity(2),\n },\n 'polygonal-nth': {\n evaluate: ([sides, n], sourceCodeInfo): number => {\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return (n * n * (sides - 2) - n * (sides - 4)) / 2\n },\n arity: toFixedArity(2),\n },\n 'polygonal?': {\n evaluate: ([sides, n], sourceCodeInfo): boolean => {\n assertNumber(n, sourceCodeInfo, { integer: true })\n assertNumber(sides, sourceCodeInfo, { integer: true, gte: 3 })\n\n if (n <= 0) {\n return false\n }\n const a = sides - 2\n const b = sides - 4\n\n const discriminant = 8 * a * n + b * b\n const sqrtPart = Math.sqrt(discriminant)\n\n // Discriminant must yield an integer square root\n if (!Number.isInteger(sqrtPart))\n return false\n\n const numerator = sqrtPart + b\n\n // Numerator must be divisible by 2*a\n if (numerator % (2 * a) !== 0)\n return false\n\n const x = numerator / (2 * a)\n\n // x must be a positive integer\n return Number.isInteger(x) && x > 0\n },\n arity: toFixedArity(2),\n },\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\n/**\n * Generates the first 'n' terms of the Recamán sequence.\n *\n * @param n - Number of terms to generate\n * @returns Array containing the first n terms of the Recamán sequence\n */\nexport function generateRecamanSequence(n: number): number[] {\n if (n === 1)\n return [0]\n\n const sequence: number[] = [0]\n const seen = new Set<number>([0])\n\n for (let i = 1; i < n; i++) {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n sequence.push(next)\n seen.add(next)\n }\n\n return sequence\n}\n\nexport const recamanSequence: SequenceDefinition<'recaman'> = {\n 'recaman-seq': length => generateRecamanSequence(length),\n 'recaman-take-while': (takeWhile) => {\n const sequence: number[] = []\n const seen = new Set<number>([0])\n\n return chain(takeWhile(0, 0), (keepFirst) => {\n if (!keepFirst)\n return sequence\n sequence.push(0)\n\n function loop(i: number): MaybePromise<number[]> {\n // Try to go backward\n let next = sequence[i - 1]! - i\n\n // If that's not positive or already seen, go forward\n if (next <= 0 || seen.has(next)) {\n next = sequence[i - 1]! + i\n }\n\n return chain(takeWhile(next, i), (keep) => {\n if (!keep)\n return sequence\n sequence.push(next)\n seen.add(next)\n return loop(i + 1)\n })\n }\n return loop(1)\n })\n },\n 'recaman?': () => true,\n}\n","import type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { SequenceDefinition } from '.'\n\nexport const thueMorseSequence: SequenceDefinition<'thue-morse'> = {\n 'thue-morse-seq': (length) => {\n const thueMorse = []\n for (let i = 0; i < length; i += 1) {\n thueMorse[i] = countSetBits(i) % 2\n }\n return thueMorse\n },\n 'thue-morse-take-while': (takeWhile) => {\n const thueMorse: number[] = []\n function loop(i: number): MaybePromise<number[]> {\n const value = countSetBits(i) % 2\n return chain(takeWhile(value, i), (keep) => {\n if (!keep)\n return thueMorse\n thueMorse.push(value)\n return loop(i + 1)\n })\n }\n return loop(0)\n },\n 'thue-morse?': n => n === 1 || n === 0,\n}\n\nfunction countSetBits(num: number): number {\n let count = 0\n while (num) {\n count += num & 1\n num >>= 1\n }\n return count\n}\n","export const tribonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 4,\n 7,\n 13,\n 24,\n 44,\n 81,\n 149,\n 274,\n 504,\n 927,\n 1705,\n 3136,\n 5768,\n 10609,\n 19513,\n 35890,\n 66012,\n 121415,\n 223317,\n 410744,\n 755476,\n 1389537,\n 2555757,\n 4700770,\n 8646064,\n 15902591,\n 29249425,\n 53798080,\n 98950096,\n 181997601,\n 334745777,\n 615693474,\n 1132436852,\n 2082876103,\n 3831006429,\n 7046319384,\n 12960201916,\n 23837527729,\n 43844049029,\n 80641778674,\n 148323355432,\n 272809183135,\n 501774317241,\n 922906855808,\n 1697490356184,\n 3122171529233,\n 5742568741225,\n 10562230626642,\n 19426970897100,\n 35731770264967,\n 65720971788709,\n 120879712950776,\n 222332455004452,\n 408933139743937,\n 752145307699165,\n 1383410902447554,\n 2544489349890656,\n 4680045560037375,\n 8607945812375585,\n]\n","import { LitsError } from '../../../../errors'\nimport type { SourceCodeInfo } from '../../../../tokenizer/token'\nimport { assertFunctionLike } from '../../../../typeGuards/lits'\nimport { assertNumber } from '../../../../typeGuards/number'\nimport { assertString } from '../../../../typeGuards/string'\nimport { toFixedArity } from '../../../../utils/arity'\nimport type { MaybePromise } from '../../../../utils/maybePromise'\nimport { chain } from '../../../../utils/maybePromise'\nimport type { BuiltinNormalExpression, BuiltinNormalExpressions } from '../../../../builtin/interface'\nimport { abundantSequence } from './abundant'\nimport { arithmeticNormalExpressions } from './arithmetic'\nimport { bellNumbers } from './bell'\nimport { bernoulliNormalExpressions } from './bernoulli'\nimport { catalanNumbers } from './catalan'\nimport { collatzSequence } from './collatz'\nimport { compositeSequence } from './composite'\nimport { deficientSequence } from './deficient'\nimport { factorialNumbers } from './factorial'\nimport { fibonacciNumbers } from './fibonacci'\nimport { geometricNormalExpressions } from './geometric'\nimport { golombSequence } from './golomb'\nimport { happySequence } from './happy'\nimport { jugglerSequence } from './juggler'\nimport { lookAndSaySequence } from './lookAndSay'\nimport { lucasNumbers } from './lucas'\nimport { luckySequence } from './lucky'\nimport { mersenneNumbers } from './mersenne'\nimport { padovanSequence } from './padovan'\nimport { partitionNumbers } from './partition'\nimport { pellNumbers } from './pell'\nimport { perfectNumbers } from './perfect'\nimport { perfectCubeSequence } from './perfectCube'\nimport { perfectPowerSequence } from './perfectPower'\nimport { perfectSquareSequence } from './perfectSquare'\nimport { poligonalNormalExpressions } from './poligonal'\nimport { primeSequence } from './prime'\nimport { recamanSequence } from './recaman'\nimport { sylvesterNumbers } from './sylvester'\nimport { thueMorseSequence } from './thueMorse'\nimport { tribonacciNumbers } from './tribonacci'\n\ntype SeqKey<T extends string> = `${T}-seq`\ntype TakeWhileKey<T extends string> = `${T}-take-while`\ntype NthKey<T extends string> = `${T}-nth`\ntype PredKey<T extends string> = `${T}?`\n\ntype SeqFunction<Type extends number | string> = (length: number, sourceCodeInfo: SourceCodeInfo | undefined) => Type[]\ntype TakeWhileFunction<Type extends number | string> = (pred: (value: Type, index: number) => MaybePromise<boolean>, sourceCodeInfo: SourceCodeInfo | undefined) => MaybePromise<Type[]>\ntype PredFunction<Type extends number | string> = (n: Type, sourceCodeInfo: SourceCodeInfo | undefined) => boolean\n\nexport type SequenceKeys<T extends string> = SeqKey<T> | TakeWhileKey<T> | NthKey<T> | PredKey<T>\n\nexport type SequenceDefinition<T extends string, Type extends number | string = number> = {\n [key in Exclude<SequenceKeys<T>, NthKey<T>>]: key extends SeqKey<T>\n ? SeqFunction<Type>\n : key extends TakeWhileKey<T>\n ? TakeWhileFunction<Type>\n : PredFunction<Type>\n} & {\n maxLength?: number\n} & (Type extends string ? {\n string: true\n} : {\n string?: never\n}) & {\n noNth?: true\n}\n\nexport type SequenceNormalExpressions<T extends string, Type extends string | number = number> = {\n [key in SequenceKeys<T>]: key extends SeqKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends TakeWhileKey<T>\n ? BuiltinNormalExpression<Type[]>\n : key extends NthKey<T>\n ? BuiltinNormalExpression<Type>\n : BuiltinNormalExpression<boolean>\n}\n\nexport const sequenceNormalExpressions: BuiltinNormalExpressions = {}\n\naddSequence(abundantSequence)\naddSequence(collatzSequence)\naddSequence(compositeSequence)\naddSequence(deficientSequence)\naddSequence(golombSequence)\naddSequence(happySequence)\naddSequence(jugglerSequence)\naddSequence(lookAndSaySequence)\naddSequence(luckySequence)\naddSequence(padovanSequence)\naddSequence(perfectSquareSequence)\naddSequence(perfectCubeSequence)\naddSequence(perfectPowerSequence)\naddSequence(primeSequence)\naddSequence(recamanSequence)\naddSequence(thueMorseSequence)\naddNormalExpressions(getFiniteNumberSequence('tribonacci', tribonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('catalan', catalanNumbers))\naddNormalExpressions(getFiniteNumberSequence('factorial', factorialNumbers))\naddNormalExpressions(getFiniteNumberSequence('fibonacci', fibonacciNumbers))\naddNormalExpressions(getFiniteNumberSequence('lucas', lucasNumbers))\naddNormalExpressions(getFiniteNumberSequence('mersenne', mersenneNumbers))\naddNormalExpressions(getFiniteNumberSequence('partition', partitionNumbers))\naddNormalExpressions(getFiniteNumberSequence('pell', pellNumbers))\naddNormalExpressions(getFiniteNumberSequence('perfect', perfectNumbers))\naddNormalExpressions(getFiniteNumberSequence('sylvester', sylvesterNumbers))\naddNormalExpressions(getFiniteNumberSequence('bell', bellNumbers))\naddNormalExpressions(arithmeticNormalExpressions)\naddNormalExpressions(bernoulliNormalExpressions)\naddNormalExpressions(geometricNormalExpressions)\naddNormalExpressions(poligonalNormalExpressions)\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n sequenceNormalExpressions[key] = value\n }\n}\n\nfunction getFiniteNumberSequence<T extends string>(name: T, sequence: number[]): SequenceNormalExpressions<T> {\n return {\n [`${name}-seq`]: createSeqNormalExpression(length => sequence.slice(0, length), sequence.length),\n [`${name}-take-while`]: createTakeWhileNormalExpression((takeWhile) => {\n function loop(i: number): MaybePromise<number[]> {\n if (i >= sequence.length)\n return sequence.slice(0, i)\n return chain(takeWhile(sequence[i]!, i), (keep) => {\n if (!keep)\n return sequence.slice(0, i)\n return loop(i + 1)\n })\n }\n return loop(0)\n }, sequence.length),\n [`${name}-nth`]: createNthNormalExpression(() => sequence, sequence.length),\n [`${name}?`]: createNumberPredNormalExpression(n => sequence.includes(n)),\n } as unknown as SequenceNormalExpressions<T>\n}\n\nfunction addSequence<Type extends number | string>(sequence: SequenceDefinition<string, Type>) {\n for (const [key, value] of Object.entries(sequence)) {\n /* v8 ignore next 3 */\n if (sequenceNormalExpressions[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n if (key.endsWith('seq')) {\n sequenceNormalExpressions[key] = createSeqNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n if (!sequence.noNth) {\n sequenceNormalExpressions[key.replace(/seq$/, 'nth')] = createNthNormalExpression(value as SeqFunction<Type>, sequence.maxLength)\n }\n }\n else if (key.endsWith('take-while')) {\n sequenceNormalExpressions[key] = createTakeWhileNormalExpression(value as TakeWhileFunction<Type>, sequence.maxLength)\n }\n else if (key.endsWith('?')) {\n if (sequence.string) {\n sequenceNormalExpressions[key] = createStringPredNormalExpression(value as PredFunction<string>)\n }\n else {\n sequenceNormalExpressions[key] = createNumberPredNormalExpression(value as PredFunction<number>)\n }\n }\n }\n}\n\nfunction createSeqNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const length = params[0] ?? maxLength\n assertNumber(length, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const result = seqFunction(length, sourceCodeInfo)\n if (typeof result[0] === 'number') {\n /* v8 ignore next 3 */\n if (result.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return result\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createTakeWhileNormalExpression<Type extends number | string>(\n takeWhileFunction: TakeWhileFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type[]> {\n return {\n evaluate: (params, sourceCodeInfo, contextStack, { executeFunction }) => {\n const fn = params[0]\n assertFunctionLike(fn, sourceCodeInfo)\n const result = takeWhileFunction(\n (value, index) => chain(executeFunction(fn, [value, index], contextStack), val => !!val),\n sourceCodeInfo,\n )\n return chain(result, (resolved) => {\n if (typeof resolved[0] === 'number') {\n /* v8 ignore next 3 */\n if (resolved.some(n => (n as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return resolved\n })\n },\n arity: typeof maxLength === 'number' ? { max: 1 } : toFixedArity(1),\n }\n}\n\nfunction createNthNormalExpression<Type extends number | string>(\n seqFunction: SeqFunction<Type>,\n maxLength: number | undefined,\n): BuiltinNormalExpression<Type> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const n = params[0]\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true, lte: maxLength })\n const sequence = seqFunction(n, sourceCodeInfo)\n if (typeof sequence[0] === 'number') {\n /* v8 ignore next 3 */\n if (sequence.some(val => (val as number) > Number.MAX_SAFE_INTEGER)) {\n throw new LitsError('Result exceeds maximum safe integer', sourceCodeInfo)\n }\n }\n return sequence[n - 1]!\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createNumberPredNormalExpression(\n predFunction: PredFunction<number>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertNumber(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n\nfunction createStringPredNormalExpression(\n predFunction: PredFunction<string>,\n): BuiltinNormalExpression<boolean> {\n return {\n evaluate: (params, sourceCodeInfo) => {\n const value = params[0]\n assertString(value, sourceCodeInfo)\n return predFunction(value, sourceCodeInfo)\n },\n arity: toFixedArity(1),\n }\n}\n","import type { SourceCodeInfo } from '../tokenizer/token'\nimport { getAssertionError } from '../utils/getAssertionError'\n\ntype StringAssertionOptions =\n | {\n nonEmpty?: true\n char?: never\n }\n | {\n nonEmpty?: never\n char?: true\n }\n\nexport function isString(value: unknown, options: StringAssertionOptions = {}): value is string {\n if (typeof value !== 'string')\n return false\n\n if (options.nonEmpty && value.length === 0)\n return false\n\n if (options.char && value.length !== 1)\n return false\n\n return true\n}\n\nexport function assertString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): asserts value is string {\n if (!isString(value, options)) {\n throw getAssertionError(\n `${options.nonEmpty ? 'non empty string' : options.char ? 'character' : 'string'}`,\n value,\n sourceCodeInfo,\n )\n }\n}\n\nexport function asString(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: StringAssertionOptions = {},\n): string {\n assertString(value, sourceCodeInfo, options)\n return value\n}\n\nexport function isStringOrNumber(value: unknown): value is string | number {\n return typeof value === 'string' || typeof value === 'number'\n}\nexport function asStringOrNumber(value: unknown, sourceCodeInfo?: SourceCodeInfo): string | number {\n assertStringOrNumber(value, sourceCodeInfo)\n return value\n}\nexport function assertStringOrNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n): asserts value is string | number {\n if (!isStringOrNumber(value))\n throw getAssertionError('string or number', value, sourceCodeInfo)\n}\n","import { LitsError } from '../../../errors'\nimport type { Arr } from '../../../interface'\nimport { assertVector } from '../../../typeGuards/annotatedArrays'\nimport { assertArray } from '../../../typeGuards/array'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { LitsModule } from '../interface'\nimport { moduleDocs } from './docs'\nimport { combinationsNormalExpressions } from './combinations'\nimport { derangementsNormalExpressions } from './derangements'\nimport { divisorsNormalExpressions, getDivisors, getProperDivisors } from './divisors'\nimport { factorialNormalExpressions, factorialOf } from './factorial'\nimport { partitionsNormalExpressions } from './partitions'\nimport { permutationsNormalExpressions } from './permutations'\nimport { powerSetNormalExpressions } from './powerSet'\nimport { primeFactors, primeFactorsNormalExpressions } from './primeFactors'\nimport { sequenceNormalExpressions } from './sequences'\nimport { perfectPower } from './sequences/perfectPower'\n\nfunction gcd(a: number, b: number): number {\n while (b !== 0) {\n const temp = b\n b = a % b\n a = temp\n }\n return Math.abs(a)\n}\n\nfunction lcm(a: number, b: number): number {\n return Math.floor((a * b) / gcd(a, b))\n}\n\nfunction mobius(n: number): number {\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n}\n\n/**\n * Efficiently computes (base^exponent) % modulus using the square-and-multiply algorithm\n * Based on the pseudocode algorithm for modular exponentiation\n *\n * @param base - The base number\n * @param exponent - The exponent (must be non-negative)\n * @param modulus - The modulus (must be positive)\n * @returns The result of (base^exponent) % modulus\n */\nfunction modExp(base: number, exponent: number, modulus: number): number {\n // Edge case: modulus is 1\n if (modulus === 1) {\n return 0\n }\n\n // Assert: (modulus - 1) * (modulus - 1) does not overflow base\n // This is a limitation of using regular JavaScript numbers instead of BigInt\n\n // Initialize result\n let result = 1\n\n // Apply modulo to base first\n base = base % modulus\n\n // Square and multiply algorithm\n while (exponent > 0) {\n // If current bit of exponent is 1, multiply result with current base\n if (exponent % 2 === 1) {\n result = (result * base) % modulus\n }\n\n // Shift exponent right (divide by 2)\n exponent = exponent >> 1\n\n // Square the base for next iteration\n base = (base * base) % modulus\n }\n\n return result\n}\n\n/**\n * Extended Euclidean Algorithm\n * Finds gcd(a,b) and coefficients x,y such that ax + by = gcd(a,b)\n */\nfunction extendedGcd(a: number, b: number): [number, number, number] {\n if (b === 0) {\n return [a, 1, 0]\n }\n\n const [g, x, y] = extendedGcd(b, a % b)\n return [g, y, x - Math.floor(a / b) * y]\n}\n\n/**\n * Modular Multiplicative Inverse\n * Finds x such that (a * x) % m = 1\n */\nfunction modInverse(a: number, m: number): number {\n const [g, x] = extendedGcd(a, m)\n\n if (g !== 1) {\n throw new Error(`Modular inverse does not exist (gcd(${a}, ${m}) = ${g})`)\n }\n\n return ((x % m) + m) % m // Ensure positive result\n}\n\n/**\n * Chinese Remainder Theorem\n * Solve system of congruences: x ≡ remainders[i] (mod moduli[i])\n * Returns the smallest positive integer that satisfies all congruences\n */\nfunction chineseRemainder(remainders: number[], moduli: number[]): number {\n // Verify moduli are pairwise coprime\n for (let i = 0; i < moduli.length; i++) {\n for (let j = i + 1; j < moduli.length; j++) {\n const extGcd = extendedGcd(moduli[i]!, moduli[j]!)[0]\n if (extGcd !== 1) {\n throw new Error(`Moduli must be pairwise coprime, but gcd(${moduli[i]}, ${moduli[j]}) = ${extGcd}`)\n }\n }\n }\n\n // Calculate product of all moduli\n const product = moduli.reduce((acc, val) => acc * val, 1)\n\n let sum = 0\n\n for (let i = 0; i < remainders.length; i++) {\n const ai = remainders[i]!\n const ni = moduli[i]!\n const bi = product / ni\n\n // Find modular multiplicative inverse of bi modulo ni\n const inverse = modInverse(bi, ni)\n\n // Add contribution from this congruence\n sum = (sum + ai * bi * inverse) % product\n }\n\n return sum\n}\n\nexport const combinatoricalNormalExpression: BuiltinNormalExpressions = {\n 'coprime?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n return gcd(a, b) === 1\n },\n arity: toFixedArity(2),\n },\n 'divisible-by?': {\n evaluate: ([value, divisor], sourceCodeInfo): boolean => {\n assertNumber(value, sourceCodeInfo, { integer: true })\n assertNumber(divisor, sourceCodeInfo, { integer: true })\n if (divisor === 0)\n return false\n return value % divisor === 0\n },\n arity: toFixedArity(2),\n },\n 'gcd': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return gcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'lcm': {\n evaluate: ([a, b], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo)\n assertNumber(b, sourceCodeInfo)\n return lcm(a, b)\n },\n arity: toFixedArity(2),\n },\n\n 'multinomial': {\n evaluate: ([...args], sourceCodeInfo): number => {\n assertVector(args, sourceCodeInfo)\n const sum = args.reduce((acc: number, curr) => {\n assertNumber(curr, sourceCodeInfo, { integer: true, nonNegative: true })\n return acc + curr\n }, 0)\n return factorialOf(sum) / args.reduce((acc, curr) => acc * factorialOf(curr), 1)\n },\n arity: { min: 1 },\n },\n 'amicable?': {\n evaluate: ([a, b], sourceCodeInfo): boolean => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(b, sourceCodeInfo, { integer: true, positive: true })\n const sumA = getProperDivisors(a).reduce((acc, curr) => acc + curr, 0)\n const sumB = getProperDivisors(b).reduce((acc, curr) => acc + curr, 0)\n return sumA === b && sumB === a && a !== b\n },\n arity: toFixedArity(2),\n },\n 'euler-totient': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n let result = n\n for (let p = 2; p * p <= n; p += 1) {\n if (n % p === 0) {\n while (n % p === 0)\n n /= p\n result -= result / p\n }\n }\n if (n > 1)\n result -= result / n\n return result\n },\n arity: toFixedArity(1),\n },\n 'mobius': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n\n const factors = primeFactors(n)\n const uniqueFactors = new Set(factors)\n\n // If n has a repeated prime factor (not square-free)\n if (uniqueFactors.size !== factors.length)\n return 0\n\n // If square-free with even number of prime factors: return 1\n // If square-free with odd number of prime factors: return -1\n return factors.length % 2 === 0 ? 1 : -1\n },\n arity: toFixedArity(1),\n },\n 'mertens': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1)\n return 1\n let result = 0\n for (let i = 1; i <= n; i++) {\n const mobiusValue = mobius(i)\n result += mobiusValue// * Math.floor(n / i)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'sigma': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n return getDivisors(n).reduce((acc, curr) => acc + curr, 0)\n },\n arity: toFixedArity(1),\n },\n 'carmichael-lambda': {\n evaluate: ([n], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n if (n === 1) {\n return 1\n }\n\n // Count occurrences of each prime factor\n const primes = primeFactors(n)\n const factorMap = new Map<number, number>()\n\n for (const prime of primes) {\n factorMap.set(prime, (factorMap.get(prime) || 0) + 1)\n }\n\n const lambdaValues: number[] = []\n\n // Calculate lambda for each prime power\n for (const [p, k] of factorMap.entries()) {\n if (p === 2) {\n if (k === 1) {\n lambdaValues.push(1) // λ(2) = 1\n }\n else if (k === 2) {\n lambdaValues.push(2) // λ(4) = 2\n }\n else {\n lambdaValues.push(2 ** (k - 2)) // λ(2^k) = 2^(k-2) for k >= 3\n }\n }\n else {\n // For odd prime powers p^k: λ(p^k) = (p-1)*p^(k-1)\n lambdaValues.push((p - 1) * p ** (k - 1))\n }\n }\n\n // Find LCM of all lambda values\n return lambdaValues.reduce((acc, val) => lcm(acc, val), 1)\n },\n arity: toFixedArity(1),\n },\n 'cartesian-product': {\n evaluate: (params, sourceCodeInfo): Arr[] => {\n params.forEach((set) => {\n assertArray(set, sourceCodeInfo)\n })\n const sets = params as Arr[]\n return sets.reduce((acc: Arr[], set) => {\n const result: Arr[] = []\n acc.forEach((arr) => {\n set.forEach((value) => {\n result.push([...arr, value])\n })\n })\n return result\n }, [[]])\n },\n arity: { min: 1 },\n },\n 'perfect-power': {\n evaluate: ([n], sourceCodeInfo): [number, number] | null => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n const result = perfectPower(n)\n return result || null\n },\n arity: toFixedArity(1),\n },\n 'mod-exp': {\n evaluate: ([base, exponent, modulus], sourceCodeInfo): number => {\n assertNumber(base, sourceCodeInfo, { finite: true })\n assertNumber(exponent, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(modulus, sourceCodeInfo, { integer: true, positive: true })\n\n return modExp(base, exponent, modulus)\n },\n arity: toFixedArity(3),\n },\n 'mod-inv': {\n evaluate: ([a, m], sourceCodeInfo): number => {\n assertNumber(a, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(m, sourceCodeInfo, { integer: true, positive: true })\n\n try {\n return modInverse(a, m)\n }\n catch (error) {\n throw new LitsError(error, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'extended-gcd': {\n evaluate: ([a, b], sourceCodeInfo): [number, number, number] => {\n assertNumber(a, sourceCodeInfo, { integer: true })\n assertNumber(b, sourceCodeInfo, { integer: true })\n\n return extendedGcd(a, b)\n },\n arity: toFixedArity(2),\n },\n 'chinese-remainder': {\n evaluate: ([remainders, moduli], sourceCodeInfo): number => {\n assertVector(remainders, sourceCodeInfo)\n assertVector(moduli, sourceCodeInfo)\n if (remainders.length !== moduli.length) {\n throw new LitsError('Remainders and moduli must have the same length.', sourceCodeInfo)\n }\n try {\n return chineseRemainder(remainders, moduli)\n }\n catch (error) {\n throw new LitsError((error as Error).message, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'stirling-first': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n\n // Create a table to store results\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Base case\n dp[0]![0] = 1\n\n // Fill the table using the recurrence relation\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = dp[i - 1]![j - 1]! + (i - 1) * dp[i - 1]![j]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n 'stirling-second': {\n evaluate: ([n, k], sourceCodeInfo): number => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(k, sourceCodeInfo, { integer: true, positive: true, lte: n })\n if (k === 1)\n return 1 // Only one way to put n objects into one subset\n if (k === n)\n return 1 // Only one way to put n objects into n subsets (one object per subset)\n\n // Create a 2D array for memoization\n const dp: number[][] = Array.from({ length: n + 1 }, () => Array<number>(k + 1).fill(0))\n\n // Initialize base cases\n dp[0]![0] = 1\n\n // Fill the dp table using the recurrence relation:\n // S(n,k) = k * S(n-1,k) + S(n-1,k-1)\n for (let i = 1; i <= n; i++) {\n for (let j = 1; j <= Math.min(i, k); j++) {\n dp[i]![j] = j * dp[i - 1]![j]! + dp[i - 1]![j - 1]!\n }\n }\n\n return dp[n]![k]!\n },\n arity: toFixedArity(2),\n },\n}\n\naddSequences(sequenceNormalExpressions)\naddNormalExpressions(factorialNormalExpressions)\naddNormalExpressions(divisorsNormalExpressions)\naddNormalExpressions(combinationsNormalExpressions)\naddNormalExpressions(permutationsNormalExpressions)\naddNormalExpressions(partitionsNormalExpressions)\naddNormalExpressions(primeFactorsNormalExpressions)\naddNormalExpressions(derangementsNormalExpressions)\naddNormalExpressions(powerSetNormalExpressions)\n\nfunction addSequences(sequences: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(sequences)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfunction addNormalExpressions(normalExpressions: BuiltinNormalExpressions) {\n for (const [key, value] of Object.entries(normalExpressions)) {\n /* v8 ignore next 3 */\n if (combinatoricalNormalExpression[key]) {\n throw new Error(`Duplicate normal expression key found: ${key}`)\n }\n combinatoricalNormalExpression[key] = value\n }\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (combinatoricalNormalExpression[key])\n combinatoricalNormalExpression[key].docs = docs\n}\n\nexport const numberTheoryModule: LitsModule = {\n name: 'number-theory',\n functions: combinatoricalNormalExpression,\n}\n","import type { SequenceDefinition } from '.'\n\nexport const collatzSequence: Omit<SequenceDefinition<'collatz'>, 'collatz-nth' | 'collatz-take-while' | 'collatz?'> = {\n 'collatz-seq': (start) => {\n let x = start\n const collatz = [x]\n while (x !== 1) {\n if (x % 2 === 0) {\n x /= 2\n }\n else {\n x = 3 * x + 1\n }\n collatz.push(x)\n }\n return collatz\n },\n 'noNth': true,\n}\n","export const catalanNumbers = [\n 1,\n 2,\n 5,\n 14,\n 42,\n 132,\n 429,\n 1430,\n 4862,\n 16796,\n 58786,\n 208012,\n 742900,\n 2674440,\n 9694845,\n 35357670,\n 129644790,\n 477638700,\n 1767263190,\n 6564120420,\n 24466267020,\n 91482563640,\n 343059613650,\n 1289904147324,\n 4861946401452,\n 18367353072152,\n 69533550916004,\n 263747951750360,\n 1002242216651368,\n 3814986502092304,\n]\n","export const fibonacciNumbers = [\n 0,\n 1,\n 1,\n 2,\n 3,\n 5,\n 8,\n 13,\n 21,\n 34,\n 55,\n 89,\n 144,\n 233,\n 377,\n 610,\n 987,\n 1597,\n 2584,\n 4181,\n 6765,\n 10946,\n 17711,\n 28657,\n 46368,\n 75025,\n 121393,\n 196418,\n 317811,\n 514229,\n 832040,\n 1346269,\n 2178309,\n 3524578,\n 5702887,\n 9227465,\n 14930352,\n 24157817,\n 39088169,\n 63245986,\n 102334155,\n 165580141,\n 267914296,\n 433494437,\n 701408733,\n 1134903170,\n 1836311903,\n 2971215073,\n 4807526976,\n 7778742049,\n 12586269025,\n 20365011074,\n 32951280099,\n 53316291173,\n 86267571272,\n 139583862445,\n 225851433717,\n 365435296162,\n 591286729879,\n 956722026041,\n 1548008755920,\n 2504730781961,\n 4052739537881,\n 6557470319842,\n 10610209857723,\n 17167680177565,\n 27777890035288,\n 44945570212853,\n 72723460248141,\n 117669030460994,\n 190392490709135,\n 308061521170129,\n 498454011879264,\n 806515533049393,\n 1304969544928657,\n 2111485077978050,\n 3416454622906707,\n 5527939700884757,\n 8944394323791464,\n]\n","export const lucasNumbers = [\n 2,\n 1,\n 3,\n 4,\n 7,\n 11,\n 18,\n 29,\n 47,\n 76,\n 123,\n 199,\n 322,\n 521,\n 843,\n 1364,\n 2207,\n 3571,\n 5778,\n 9349,\n 15127,\n 24476,\n 39603,\n 64079,\n 103682,\n 167761,\n 271443,\n 439204,\n 710647,\n 1149851,\n 1860498,\n 3010349,\n 4870847,\n 7881196,\n 12752043,\n 20633239,\n 33385282,\n 54018521,\n 87403803,\n 141422324,\n 228826127,\n 370248451,\n 599074578,\n 969323029,\n 1568397607,\n 2537720636,\n 4106118243,\n 6643838879,\n 10749957122,\n 17393796001,\n 28143753123,\n 45537549124,\n 73681302247,\n 119218851371,\n 192900153618,\n 312119004989,\n 505019158607,\n 817138163596,\n 1322157322203,\n 2139295485799,\n 3461452808002,\n 5600748293801,\n 9062201101803,\n 14662949395604,\n 23725150497407,\n 38388099893011,\n 62113250390418,\n 100501350283429,\n 162614600673847,\n 263115950957276,\n 425730551631123,\n 688846502588399,\n 1114577054219522,\n 1803423556807921,\n 2918000611027443,\n 4721424167835364,\n 7639424778862807,\n]\n","export const mersenneNumbers = [3, 7, 31, 127, 2047, 8191, 131071, 524287, 2147483647]\n","export const pellNumbers = [\n 1,\n 2,\n 5,\n 12,\n 29,\n 70,\n 169,\n 408,\n 985,\n 2378,\n 5741,\n 13860,\n 33461,\n 80782,\n 195025,\n 470832,\n 1136689,\n 2744210,\n 6625109,\n 15994428,\n 38613965,\n 93222358,\n 225058681,\n 543339720,\n 1311738121,\n 3166815962,\n 7645370045,\n 18457556052,\n 44560482149,\n 107578520350,\n 259717522849,\n 627013566048,\n 1513744654945,\n 3654502875938,\n 8822750406821,\n 21300003689580,\n 51422757785981,\n 124145519261542,\n 299713796309065,\n 723573111879672,\n 1746860020068409,\n 4217293152016490,\n]\n","export const perfectNumbers = [6, 28, 496, 8128, 33550336, 8589869056, 137438691328]\n","export const sylvesterNumbers = [\n 2,\n 6,\n 42,\n 1806,\n 3263442,\n 10650056950806,\n]\n","export const bellNumbers = [\n 1,\n 2,\n 5,\n 15,\n 52,\n 203,\n 877,\n 4140,\n 21147,\n 115975,\n 678570,\n 4213597,\n 27644437,\n 190899322,\n 1382958545,\n 10480142147,\n 82864869804,\n 682076806159,\n 5832742205057,\n 51724158235372,\n 474869816156751,\n 4506715738447323,\n]\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","LitsError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getLitsErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","FUNCTION_SYMBOL","REGEXP_SYMBOL","isLitsFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","getSourceCodeInfo","anyValue","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","annotatedArrays","WeakSet","vectors","notVectors","assertVector","vector","every","elem","add","isVector","getAssertionError","typeName","assertArray","isObj","regexp","isColl","isSeq","assertFunctionLike","isFunctionLike","toFixedArity","arity","min","moduleDocs","category","description","returns","array","args","variants","argumentNames","examples","seeAlso","takeWhile","n","start","step","ratio","term","sides","a","b","combinations","set","derangements","divisors","factorial","partitions","permutations","gcd","lcm","multinomial","rest","hideOperatorForm","mobius","mertens","sigma","sets","base","exponent","modulus","remainders","moduli","binomialCoefficient","k","result","i","collection","size","map","item","current","subCombinations","slice","subComb","push","combinationsNormalExpressions","evaluate","derangementsNormalExpressions","arr","used","from","temp","generateDerangements","pos","getAllDerangements","countDerangements","calcUnsortedDivisors","number","sqrt","getDivisors","sort","getProperDivisors","divisorsNormalExpressions","factorialNumbers","factorialOf","factorialNormalExpressions","partitionNumbers","partitionsNormalExpressions","generatePartitions","remaining","pop","subPermutations","subPerm","permutationsNormalExpressions","powerSetNormalExpressions","newSubsets","subset","powerSet","Infinity","primeFactors","factors","divisor","primeFactorsNormalExpressions","distinctFactors","chain","fn","Promise","then","isAbundant","num","reduce","acc","curr","abundantSequence","abundants","loop","keep","approxEqual","epsilon","diff","abs","arithmeticNormalExpressions","_","contextStack","executeFunction","s","d","f","arithmetic","roundedPosition","round","calculatedValue","isInArithmeticSequence","getBernoulliSeq","bernoulli","sum","bernoulliNormalExpressions","predicate","newValue","generateBernoulli","index","val","isPrime","primeSequence","primes","isComposite","compositeSequence","composites","isDeficient","deficientSequence","deficients","geometricNormalExpressions","r","geometric","initialTerm","logResult","log","roundedLogResult","expectedSign","isInGeometricSequence","golombSequence","golomb","getGolombSeq","pred","keepFirst","golombNumber","generateGolombSeq","isHappyNumber","seen","getSumOfSquaredDigits","digit","floor","happySequence","happyNumbers","split","jugglerSequence","next","juggler","noNth","getNextLookAndSayTerm","count","lookAndSaySequence","string","lookAndSay","replace","match","target","isLookAndSay","generateLuckyNumbers","numbers","filteredNumbers","luckyNumbers","luckyNumber","newFiltered","luckySequence","initialSize","sieveIndex","sieveValue","j","getLuckyNumbers","l","includes","padovanSequence","padovan","padovanNumbers","MAX_SAFE_INTEGER","c","isSafeInteger","isPadovan","keep0","keep1","keep2","perfectCubeSequence","perfectcubes","cbrt","perfectPower","maxK","log2","roundedB","perfectPowerSequence","perfectPowers","perfectSquareSequence","perfectSquares","poligonalNormalExpressions","polygonal","discriminant","sqrtPart","numerator","recamanSequence","sequence","generateRecamanSequence","thueMorseSequence","thueMorse","countSetBits","sequenceNormalExpressions","addNormalExpressions","normalExpressions","entries","getFiniteNumberSequence","createSeqNormalExpression","createTakeWhileNormalExpression","createNthNormalExpression","createNumberPredNormalExpression","addSequence","endsWith","maxLength","createStringPredNormalExpression","seqFunction","params","some","takeWhileFunction","resolved","predFunction","nonEmpty","char","isString","assertString","extendedGcd","g","y","modInverse","m","collatz","combinatoricalNormalExpression","sumA","sumB","p","factorMap","Map","prime","get","lambdaValues","forEach","modExp","error","extGcd","product","ai","ni","bi","chineseRemainder","dp","fill","sequences","addSequences","docs","numberTheoryModule","functions"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAkBC,MACbX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA6BD,EAAiBf,GAC5C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA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A,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBACA,iBAC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ACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBCkCFH,GAAqBG,GAAwB,UIjGf,CAC5B,EACA,EACA,EACA,GACA,GACA,IACA,IACA,KACA,KACA,MACA,MACA,OACA,OACA,QACA,QACA,SACA,UACA,UACA,WACA,WACA,YACA,YACA,aACA,cACA,cACA,eACA,eACA,eACA,gBACA,mBJoEFH,GAAqBG,GAAwB,YAAa3J,IAC1DwJ,GAAqBG,GAAwB,YKnGb,CAC9B,EACA,EACA,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA,YACA,aACA,aACA,aACA,aACA,aACA,cACA,cACA,cACA,cACA,cACA,cACA,eACA,eACA,eACA,eACA,eACA,gBACA,gBACA,gBACA,gBACA,gBACA,gBACA,iBACA,oBLqBFH,GAAqBG,GAAwB,QMpGjB,CAC1B,EACA,EACA,EACA,EACA,EACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,KACA,KACA,KACA,KACA,KACA,MACA,MACA,MACA,MACA,OACA,OACA,OACA,OACA,OACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,SACA,SACA,SACA,UACA,UACA,UACA,UACA,UACA,WACA,WACA,WACA,WACA,YACA,YACA,YACA,YACA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