@mojir/lits
Version:
Lits is a pure functional programming language implemented in TypeScript
1 lines • 127 kB
JavaScript
function e(e){if(!e.position||!e.code)return"";const t=e.position.column-1,r=e.code.length-t-1;return`${" ".repeat(Math.max(t,0))}^${" ".repeat(Math.max(r,0))}`}class t extends Error{sourceCodeInfo;shortMessage;constructor(r,n){const o=r instanceof Error?r.message:`${r}`;super(function(t,r){if(!r)return t;const n=`${r.position.line}:${r.position.column}`;return`${t}${r.filePath?`\n${r.filePath}:${n}`:`\nLocation ${n}`}\n${r.code}\n${e(r)}`}(o,n)),this.shortMessage=o,this.sourceCodeInfo=n,Object.setPrototypeOf(this,t.prototype),this.name="LitsError"}getCodeMarker(){return this.sourceCodeInfo&&e(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},n=new Set(Object.values(r));const o=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);const i="^^fn^^",a="^^re^^";function s(e){return null!==e&&"object"==typeof e&&(i in e&&"functionType"in e&&("string"==typeof(t=e.functionType)&&o.has(t)));var t}function m(e){return!(!Array.isArray(e)||e.length<2)&&("number"==typeof(t=e[0])&&n.has(t));var t}function u(e){return s(e)?`<function ${e.name||"λ"}>`:m(e)?`${t=e[0],Object.keys(r).find(e=>r[e]===t)}-node`:null===e?"null":"object"==typeof e&&e instanceof RegExp?`${e}`:"object"==typeof e&&e instanceof Error?e.toString():JSON.stringify(e);var t}function h(e,t){return e?.sourceCodeInfo??t}function c(e,t={}){return"number"==typeof e&&(!Number.isNaN(e)&&(!(t.integer&&!Number.isInteger(e))&&(!(t.finite&&!Number.isFinite(e))&&((!t.zero||0===e)&&((!t.nonZero||0!==e)&&(!(t.positive&&e<=0)&&(!(t.negative&&e>=0)&&(!(t.nonPositive&&e>0)&&(!(t.nonNegative&&e<0)&&(!("number"==typeof t.gt&&e<=t.gt)&&(!("number"==typeof t.gte&&e<t.gte)&&(!("number"==typeof t.lt&&e>=t.lt)&&!("number"==typeof t.lte&&e>t.lte)))))))))))))}function l(e,r,n={}){if(!c(e,n))throw new t(`Expected ${function(e){if(e.zero)return"zero";const t=function(e){return e.positive?"positive":e.negative?"negative":e.nonNegative?"non negative":e.nonPositive?"non positive":e.nonZero?"non zero":""}(e),r=e.integer?"integer":"number",n=e.finite?"finite":"",o=function(e){return"number"!=typeof e.gt&&"number"!=typeof e.gte||"number"!=typeof e.lt&&"number"!=typeof e.lte?"number"==typeof e.gt||"number"==typeof e.gte?"number"==typeof e.gt?`n > ${e.gt}`:`n >= ${e.gte}`:"number"==typeof e.lt||"number"==typeof e.lte?"number"==typeof e.lt?`n < ${e.lt}`:`n <= ${e.lte}`:"":`${"number"==typeof e.gt?`${e.gt} < n `:`${e.gte} <= n `}${"number"==typeof e.lt?`< ${e.lt}`:`<= ${e.lte}`}`}(e);return[t,n,r,o].filter(e=>!!e).join(" ")}(n)}, got ${u(e)}.`,h(e,r))}const p=new WeakSet,y=new WeakSet,b=new WeakSet;function g(e,r){if(!function(e){return!(!Array.isArray(e)||!y.has(e)&&(b.has(e)||(e.every(e=>c(e))?(p.add(e),y.add(e),0):(b.add(e),1))))}(e))throw new t(`Expected a vector, but got ${e}`,r)}function f(e,r,n){return new t(`Expected ${e}, got ${u(r)}.`,h(r,n))}function d(e,t){if(!Array.isArray(e))throw f("array",e,t)}function q(e){return null!==e&&"object"==typeof e&&!!e[i]}function v(e){return!(null===e||"object"!=typeof e||Array.isArray(e)||e instanceof RegExp||q(e)||(t=e,null!==t&&"object"==typeof t&&t[a]));var t}function k(e){return function(e){return Array.isArray(e)||"string"==typeof e}(e)||v(e)}function w(e,t){if(!function(e){return"number"==typeof e||!!k(e)||!!q(e)}(e))throw f("FunctionLike",e,t)}function x(e){return{min:e,max:e}}const A={"abundant-seq":{category:"number-theory",description:"Generates the abundant numbers up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { abundant-seq } = import(number-theory);\nabundant-seq(1)","let { abundant-seq } = import(number-theory);\nabundant-seq(5)"],seeAlso:["number-theory.abundant-nth","number-theory.abundant-take-while","number-theory.abundant?","number-theory.deficient-seq","number-theory.perfect-seq"]},"abundant-take-while":{category:"number-theory",description:"Generates the abundant numbers while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { abundant-take-while } = import(number-theory);\nabundant-take-while(-> $ < 100)"],seeAlso:["number-theory.abundant-seq","number-theory.abundant-nth","number-theory.abundant?"]},"abundant-nth":{category:"number-theory",description:"Generates the nth term of the abundant numbers.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the number in the sequence."}},variants:[{argumentNames:["n"]}],examples:["let { abundant-nth } = import(number-theory);\nabundant-nth(1)","let { abundant-nth } = import(number-theory);\nabundant-nth(5)"],seeAlso:["number-theory.abundant-seq","number-theory.abundant-take-while","number-theory.abundant?"]},"abundant?":{category:"number-theory",description:"Checks if a number is abundant.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { abundant? } = import(number-theory);\nabundant?(12)","let { abundant? } = import(number-theory);\nabundant?(15)"],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"]},"arithmetic-seq":{category:"number-theory",description:"Generates the arithmetic sequence for a given $start, $step, and $length.",returns:{type:"integer",array:!0},args:{start:{type:"number",description:"The starting term of the sequence."},step:{type:"number",description:"The common difference of the sequence."},length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["start","step","length"]}],examples:["let { arithmetic-seq } = import(number-theory);\narithmetic-seq(3, 2, 2)","let { arithmetic-seq } = import(number-theory);\narithmetic-seq(2, 3, 2)","let { arithmetic-seq } = import(number-theory);\narithmetic-seq(1, 2, 2)","let { arithmetic-seq } = import(number-theory);\narithmetic-seq(1, 1.5, 12)"],seeAlso:["number-theory.arithmetic-nth","number-theory.arithmetic-take-while","number-theory.arithmetic?","number-theory.geometric-seq"]},"arithmetic-take-while":{category:"number-theory",description:"Generates the arithmetic sequence while a condition is met.",returns:{type:"integer",array:!0},args:{start:{type:"number",description:"The starting term of the sequence."},step:{type:"number",description:"The common difference of the sequence."},takeWhile:{type:"function",description:"A function that takes a number and an index and returns a boolean."}},variants:[{argumentNames:["start","step","takeWhile"]}],examples:["let { arithmetic-take-while } = import(number-theory);\narithmetic-take-while(1, 0.25, -> $ < 3)"],seeAlso:["number-theory.arithmetic-seq","number-theory.arithmetic-nth","number-theory.arithmetic?"]},"arithmetic-nth":{category:"number-theory",description:"Generates the nth term of the arithmetic sequence.",returns:{type:"integer"},args:{start:{type:"number",description:"The starting term of the sequence."},step:{type:"number",description:"The common difference of the sequence."},n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["start","step","n"]}],examples:["let { arithmetic-nth } = import(number-theory);\narithmetic-nth(3, 2, 2)","let { arithmetic-nth } = import(number-theory);\narithmetic-nth(2, 3, 2)","let { arithmetic-nth } = import(number-theory);\narithmetic-nth(1, 2, 2)","let { arithmetic-nth } = import(number-theory);\narithmetic-nth(1, 1.5, 12)"],seeAlso:["number-theory.arithmetic-seq","number-theory.arithmetic-take-while","number-theory.arithmetic?"]},"arithmetic?":{category:"number-theory",description:"Checks if a number is part of the arithmetic sequence.",returns:{type:"boolean"},args:{start:{type:"number",description:"The starting term of the sequence."},step:{type:"number",description:"The common difference of the sequence."},n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["start","step","n"]}],examples:["let { arithmetic? } = import(number-theory);\narithmetic?(3, 2, 2)","let { arithmetic? } = import(number-theory);\narithmetic?(2, 3, 2)","let { arithmetic? } = import(number-theory);\narithmetic?(1, 2, 2)","let { arithmetic? } = import(number-theory);\narithmetic?(1, 1.5, 12)"],seeAlso:["number-theory.arithmetic-seq","number-theory.arithmetic-nth","number-theory.geometric?","number-theory.arithmetic-take-while"]},"bell-seq":{category:"number-theory",description:"Generates the Bell sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 22 (the maximum length of the pre-calculated bell numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { bell-seq } = import(number-theory);\nbell-seq(5)","let { bell-seq } = import(number-theory);\nbell-seq(10)","let { bell-seq } = import(number-theory);\nbell-seq()"],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"]},"bell-take-while":{category:"number-theory",description:"Generates the Bell sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { bell-take-while } = import(number-theory);\nbell-take-while(-> $ < 1000)"],seeAlso:["number-theory.bell-seq","number-theory.bell-nth","number-theory.bell?"]},"bell-nth":{category:"number-theory",description:"Generates the nth term of the Bell sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { bell-nth } = import(number-theory);\nbell-nth(5)","let { bell-nth } = import(number-theory);\nbell-nth(10)"],seeAlso:["number-theory.bell-seq","number-theory.bell-take-while","number-theory.bell?"]},"bell?":{category:"number-theory",description:"Checks if a number is in the Bell sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { bell? } = import(number-theory);\nbell?(1)","let { bell? } = import(number-theory);\nbell?(27644437)","let { bell? } = import(number-theory);\nbell?(27644436)"],seeAlso:["number-theory.bell-seq","number-theory.bell-nth","number-theory.catalan?","number-theory.bell-take-while"]},"bernoulli-seq":{category:"number-theory",description:"Generates the Bernoulli sequence up to a specified length.",returns:{type:"number",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { bernoulli-seq } = import(number-theory);\nbernoulli-seq(5)","let { bernoulli-seq } = import(number-theory);\nbernoulli-seq(10)"],seeAlso:["number-theory.bernoulli-nth","number-theory.bernoulli-take-while"]},"bernoulli-take-while":{category:"number-theory",description:"Generates the Bernoulli sequence while a condition is met.",returns:{type:"number",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { bernoulli-take-while } = import(number-theory);\nbernoulli-take-while(-> abs($) < 100)"],seeAlso:["number-theory.bernoulli-seq","number-theory.bernoulli-nth"]},"bernoulli-nth":{category:"number-theory",description:"Generates the nth term of the Bernoulli sequence.",returns:{type:"number"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { bernoulli-nth } = import(number-theory);\nbernoulli-nth(5)","let { bernoulli-nth } = import(number-theory);\nbernoulli-nth(10)","let { bernoulli-nth } = import(number-theory);\nbernoulli-nth(23)"],seeAlso:["number-theory.bernoulli-seq","number-theory.bernoulli-take-while"]},"catalan-seq":{category:"number-theory",description:"Generates the Catalan sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 30 (the maximum length of the pre-calculated catalan numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { catalan-seq } = import(number-theory);\ncatalan-seq(5)","let { catalan-seq } = import(number-theory);\ncatalan-seq(10)","let { catalan-seq } = import(number-theory);\ncatalan-seq()"],seeAlso:["number-theory.catalan-nth","number-theory.catalan-take-while","number-theory.catalan?","number-theory.bell-seq"]},"catalan-take-while":{category:"number-theory",description:"Generates the Catalan sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { catalan-take-while } = import(number-theory);\ncatalan-take-while(-> $ < 1000)"],seeAlso:["number-theory.catalan-seq","number-theory.catalan-nth","number-theory.catalan?"]},"catalan-nth":{category:"number-theory",description:"Generates the nth term of the Catalan sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { catalan-nth } = import(number-theory);\ncatalan-nth(5)","let { catalan-nth } = import(number-theory);\ncatalan-nth(10)"],seeAlso:["number-theory.catalan-seq","number-theory.catalan-take-while","number-theory.catalan?"]},"catalan?":{category:"number-theory",description:"Determines if a number is in the Catalan sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { catalan? } = import(number-theory);\ncatalan?(5)","let { catalan? } = import(number-theory);\ncatalan?(10)"],seeAlso:["number-theory.catalan-seq","number-theory.catalan-nth","number-theory.bell?","number-theory.catalan-take-while"]},"collatz-seq":{category:"number-theory",description:"Generates the collatz sequence starting from a given integer.",returns:{type:"integer",array:!0},args:{start:{type:"integer",description:"The starting integer for the collatz sequence."}},variants:[{argumentNames:["start"]}],examples:["let { collatz-seq } = import(number-theory);\ncollatz-seq(3)","let { collatz-seq } = import(number-theory);\ncollatz-seq(11)"],seeAlso:["number-theory.juggler-seq"]},"composite-seq":{category:"number-theory",description:"Generates the composite sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { composite-seq } = import(number-theory);\ncomposite-seq(1)","let { composite-seq } = import(number-theory);\ncomposite-seq(2)","let { composite-seq } = import(number-theory);\ncomposite-seq(10)"],seeAlso:["number-theory.composite-nth","number-theory.composite-take-while","number-theory.composite?","number-theory.prime-seq"]},"composite-take-while":{category:"number-theory",description:"Generates the composite sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { composite-take-while } = import(number-theory);\ncomposite-take-while(-> $ < 50)"],seeAlso:["number-theory.composite-seq","number-theory.composite-nth","number-theory.composite?"]},"composite-nth":{category:"number-theory",description:"Generates the nth term of the composite sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the composite number to retrieve."}},variants:[{argumentNames:["n"]}],examples:["let { composite-nth } = import(number-theory);\ncomposite-nth(1)","let { composite-nth } = import(number-theory);\ncomposite-nth(2)","let { composite-nth } = import(number-theory);\ncomposite-nth(10)"],seeAlso:["number-theory.composite-seq","number-theory.composite-take-while","number-theory.composite?"]},"composite?":{category:"number-theory",description:"Determines if a number is composite.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { composite? } = import(number-theory);\ncomposite?(4)","let { composite? } = import(number-theory);\ncomposite?(5)","let { composite? } = import(number-theory);\ncomposite?(11)"],seeAlso:["number-theory.composite-seq","number-theory.composite-nth","number-theory.prime?","number-theory.prime-factors","number-theory.composite-take-while"]},"deficient-seq":{category:"number-theory",description:"Generates the deficient numbers up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { deficient-seq } = import(number-theory);\ndeficient-seq(1)","let { deficient-seq } = import(number-theory);\ndeficient-seq(5)"],seeAlso:["number-theory.deficient-nth","number-theory.deficient-take-while","number-theory.deficient?","number-theory.abundant-seq","number-theory.perfect-seq"]},"deficient-take-while":{category:"number-theory",description:"Generates the deficient numbers while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { deficient-take-while } = import(number-theory);\ndeficient-take-while(-> $ < 100)"],seeAlso:["number-theory.deficient-seq","number-theory.deficient-nth","number-theory.deficient?"]},"deficient-nth":{category:"number-theory",description:"Generates the nth term of the deficient numbers.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the number in the sequence."}},variants:[{argumentNames:["n"]}],examples:["let { deficient-nth } = import(number-theory);\ndeficient-nth(5)","let { deficient-nth } = import(number-theory);\ndeficient-nth(12)"],seeAlso:["number-theory.deficient-seq","number-theory.deficient-take-while","number-theory.deficient?"]},"deficient?":{category:"number-theory",description:"Checks if a number is deficient.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { deficient? } = import(number-theory);\ndeficient?(12)","let { deficient? } = import(number-theory);\ndeficient?(15)"],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"]},"factorial-seq":{category:"number-theory",description:"Generates the factorial sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 19 (the maximum length of the pre-calculated factorial numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { factorial-seq } = import(number-theory);\nfactorial-seq(1)","let { factorial-seq } = import(number-theory);\nfactorial-seq(2)","let { factorial-seq } = import(number-theory);\nfactorial-seq(3)","let { factorial-seq } = import(number-theory);\nfactorial-seq(4)","let { factorial-seq } = import(number-theory);\nfactorial-seq(5)","let { factorial-seq } = import(number-theory);\nfactorial-seq(10)"],seeAlso:["number-theory.factorial-nth","number-theory.factorial-take-while","number-theory.factorial?","number-theory.factorial"]},"factorial-take-while":{category:"number-theory",description:"Generates the factorial sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { factorial-take-while } = import(number-theory);\nfactorial-take-while(-> $ < 1000)"],seeAlso:["number-theory.factorial-seq","number-theory.factorial-nth","number-theory.factorial?"]},"factorial-nth":{category:"number-theory",description:"Generates the nth term of the factorial sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { factorial-nth } = import(number-theory);\nfactorial-nth(1)","let { factorial-nth } = import(number-theory);\nfactorial-nth(2)","let { factorial-nth } = import(number-theory);\nfactorial-nth(3)","let { factorial-nth } = import(number-theory);\nfactorial-nth(4)","let { factorial-nth } = import(number-theory);\nfactorial-nth(5)","let { factorial-nth } = import(number-theory);\nfactorial-nth(10)"],seeAlso:["number-theory.factorial-seq","number-theory.factorial-take-while","number-theory.factorial?","number-theory.factorial"]},"factorial?":{category:"number-theory",description:"Checks if a number is in the factorial sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { factorial? } = import(number-theory);\nfactorial?(1)","let { factorial? } = import(number-theory);\nfactorial?(2)","let { factorial? } = import(number-theory);\nfactorial?(3)","let { factorial? } = import(number-theory);\nfactorial?(4)","let { factorial? } = import(number-theory);\nfactorial?(5)","let { factorial? } = import(number-theory);\nfactorial?(6)","let { factorial? } = import(number-theory);\nfactorial?(7)","let { factorial? } = import(number-theory);\nfactorial?(8)","let { factorial? } = import(number-theory);\nfactorial?(9)","let { factorial? } = import(number-theory);\nfactorial?(3628800)"],seeAlso:["number-theory.factorial-seq","number-theory.factorial-nth","number-theory.factorial","number-theory.factorial-take-while"]},"fibonacci-seq":{category:"number-theory",description:"Generates the fibonacci sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 79 (the maximum length of the pre-calculated Fibonacci numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { fibonacci-seq } = import(number-theory);\nfibonacci-seq(1)","let { fibonacci-seq } = import(number-theory);\nfibonacci-seq(2)","let { fibonacci-seq } = import(number-theory);\nfibonacci-seq()"],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"]},"fibonacci-take-while":{category:"number-theory",description:"Generates the fibonacci sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { fibonacci-take-while } = import(number-theory);\nfibonacci-take-while(-> $ < 100)"],seeAlso:["number-theory.fibonacci-seq","number-theory.fibonacci-nth","number-theory.fibonacci?"]},"fibonacci-nth":{category:"number-theory",description:"Generates the nth term of the fibonacci sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { fibonacci-nth } = import(number-theory);\nfibonacci-nth(5)","let { fibonacci-nth } = import(number-theory);\nfibonacci-nth(50)"],seeAlso:["number-theory.fibonacci-seq","number-theory.fibonacci-take-while","number-theory.fibonacci?"]},"fibonacci?":{category:"number-theory",description:"Determines if a number is in the fibonacci sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { fibonacci? } = import(number-theory);\nfibonacci?(0)","let { fibonacci? } = import(number-theory);\nfibonacci?(1)","let { fibonacci? } = import(number-theory);\nfibonacci?(2)","let { fibonacci? } = import(number-theory);\nfibonacci?(3)","let { fibonacci? } = import(number-theory);\nfibonacci?(4)","let { fibonacci? } = import(number-theory);\nfibonacci?(5)","let { fibonacci? } = import(number-theory);\nfibonacci?(6)","let { fibonacci? } = import(number-theory);\nfibonacci?(7)","let { fibonacci? } = import(number-theory);\nfibonacci?(8)","let { fibonacci? } = import(number-theory);\nfibonacci?(9)"],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?"]},"geometric-seq":{category:"number-theory",description:"Generates the geometric sequence for a given $start, $ratio, and $length.",returns:{type:"integer",array:!0},args:{start:{type:"number",description:"The starting term of the sequence."},ratio:{type:"number",description:"The common ratio of the sequence."},length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["start","ratio","length"]}],examples:["let { geometric-seq } = import(number-theory);\ngeometric-seq(3, 2, 2)","let { geometric-seq } = import(number-theory);\ngeometric-seq(2, 3, 2)","let { geometric-seq } = import(number-theory);\ngeometric-seq(1, 2, 2)","let { geometric-seq } = import(number-theory);\ngeometric-seq(1, 1.5, 12)"],seeAlso:["number-theory.geometric-nth","number-theory.geometric-take-while","number-theory.geometric?","number-theory.arithmetic-seq"]},"geometric-take-while":{category:"number-theory",description:"Generates the geometric sequence while a condition is met.",returns:{type:"integer",array:!0},args:{start:{type:"number",description:"The starting term of the sequence."},ratio:{type:"number",description:"The common ratio of the sequence."},takeWhile:{type:"function",description:"A function that takes a number and an index and returns a boolean."}},variants:[{argumentNames:["start","ratio","takeWhile"]}],examples:["let { geometric-take-while } = import(number-theory);\ngeometric-take-while(1, 1.5, -> $ < 10)"],seeAlso:["number-theory.geometric-seq","number-theory.geometric-nth","number-theory.geometric?"]},"geometric-nth":{category:"number-theory",description:"Generates the nth term of the geometric sequence.",returns:{type:"integer"},args:{start:{type:"number",description:"The starting term of the sequence."},ratio:{type:"number",description:"The common ratio of the sequence."},n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["start","ratio","n"]}],examples:["let { geometric-nth } = import(number-theory);\ngeometric-nth(3, 2, 2)","let { geometric-nth } = import(number-theory);\ngeometric-nth(2, 3, 2)","let { geometric-nth } = import(number-theory);\ngeometric-nth(1, 2, 2)","let { geometric-nth } = import(number-theory);\ngeometric-nth(1, 1.5, 4)"],seeAlso:["number-theory.geometric-seq","number-theory.geometric-take-while","number-theory.geometric?"]},"geometric?":{category:"number-theory",description:"Checks if a number is in the geometric sequence.",returns:{type:"boolean"},args:{start:{type:"number",description:"The starting term of the sequence."},ratio:{type:"number",description:"The common ratio of the sequence."},n:{type:"number",description:"The number to check."}},variants:[{argumentNames:["start","ratio","n"]}],examples:["let { geometric? } = import(number-theory);\ngeometric?(1, 2, 1)","let { geometric? } = import(number-theory);\ngeometric?(2, 3, 2)","let { geometric? } = import(number-theory);\ngeometric?(3, 2, 2)","let { geometric? } = import(number-theory);\ngeometric?(1, 1.5, 2.25)","let { geometric? } = import(number-theory);\ngeometric?(1, 1.5, -4)"],seeAlso:["number-theory.geometric-seq","number-theory.geometric-nth","number-theory.arithmetic?","number-theory.geometric-take-while"]},"golomb-seq":{category:"number-theory",description:"Generates the Golomb sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { golomb-seq } = import(number-theory);\ngolomb-seq(5)","let { golomb-seq } = import(number-theory);\ngolomb-seq(20)"],seeAlso:["number-theory.golomb-nth","number-theory.golomb-take-while","number-theory.golomb?","number-theory.recaman-seq"]},"golomb-take-while":{category:"number-theory",description:"Generates the Golomb sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { golomb-take-while } = import(number-theory);\ngolomb-take-while(-> $ <= 10)"],seeAlso:["number-theory.golomb-seq","number-theory.golomb-nth","number-theory.golomb?"]},"golomb-nth":{category:"number-theory",description:"Generates the nth term of the Golomb sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { golomb-nth } = import(number-theory);\ngolomb-nth(5)","let { golomb-nth } = import(number-theory);\ngolomb-nth(1000)"],seeAlso:["number-theory.golomb-seq","number-theory.golomb-take-while","number-theory.golomb?"]},"golomb?":{category:"number-theory",description:"Checks if a number is in the Golomb sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { golomb? } = import(number-theory);\ngolomb?(1)","let { golomb? } = import(number-theory);\ngolomb?(2)","let { golomb? } = import(number-theory);\ngolomb?(3345)","let { golomb? } = import(number-theory);\ngolomb?(67867864)"],seeAlso:["number-theory.golomb-seq","number-theory.golomb-nth","number-theory.golomb-take-while"]},"happy-seq":{category:"number-theory",description:"Generates the happy sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 20 (the maximum length of the pre-calculated happy numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { happy-seq } = import(number-theory);\nhappy-seq(1)","let { happy-seq } = import(number-theory);\nhappy-seq(2)","let { happy-seq } = import(number-theory);\nhappy-seq(20)"],seeAlso:["number-theory.happy-nth","number-theory.happy-take-while","number-theory.happy?","number-theory.lucky-seq"]},"happy-take-while":{category:"number-theory",description:"Generates the happy sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { happy-take-while } = import(number-theory);\nhappy-take-while(-> $ < 100)"],seeAlso:["number-theory.happy-seq","number-theory.happy-nth","number-theory.happy?"]},"happy-nth":{category:"number-theory",description:"Generates the nth term of the happy sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the happy number to return."}},variants:[{argumentNames:["n"]}],examples:["let { happy-nth } = import(number-theory);\nhappy-nth(1)","let { happy-nth } = import(number-theory);\nhappy-nth(2)","let { happy-nth } = import(number-theory);\nhappy-nth(20)"],seeAlso:["number-theory.happy-seq","number-theory.happy-take-while","number-theory.happy?"]},"happy?":{category:"number-theory",description:"Determines if a number is a happy number.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { happy? } = import(number-theory);\nhappy?(1)","let { happy? } = import(number-theory);\nhappy?(2)","let { happy? } = import(number-theory);\nhappy?(100)"],seeAlso:["number-theory.happy-seq","number-theory.happy-nth","number-theory.happy-take-while"]},"juggler-seq":{category:"number-theory",description:"Generates the Juggler sequence starting from a given integer.",returns:{type:"integer",array:!0},args:{start:{type:"integer",description:"The starting integer for the Juggler sequence."}},variants:[{argumentNames:["start"]}],examples:["let { juggler-seq } = import(number-theory);\njuggler-seq(3)","let { juggler-seq } = import(number-theory);\njuggler-seq(5)"],seeAlso:["number-theory.collatz-seq"]},"look-and-say-seq":{category:"number-theory",description:"Generates the Look-and-Say sequence up to a specified length.",returns:{type:"string",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { look-and-say-seq } = import(number-theory);\nlook-and-say-seq(5)"],seeAlso:["number-theory.look-and-say-nth","number-theory.look-and-say-take-while","number-theory.look-and-say?"]},"look-and-say-take-while":{category:"number-theory",description:"Generates the Look-and-Say sequence while a condition is met.",returns:{type:"string",array:!0},args:{takeWhile:{type:"function",description:"A function that takes a string and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { look-and-say-take-while } = import(number-theory);\nlook-and-say-take-while((term, index) -> count(term) < 10)","let { look-and-say-take-while } = import(number-theory);\nlook-and-say-take-while(-> $2 <= 10)"],seeAlso:["number-theory.look-and-say-seq","number-theory.look-and-say-nth","number-theory.look-and-say?"]},"look-and-say-nth":{category:"number-theory",description:"Generates the nth term of the Look-and-Say sequence.",returns:{type:"string"},args:{n:{type:"integer",description:"The index of the term in the sequence."}},variants:[{argumentNames:["n"]}],examples:["let { look-and-say-nth } = import(number-theory);\nlook-and-say-nth(5)"],seeAlso:["number-theory.look-and-say-seq","number-theory.look-and-say-take-while","number-theory.look-and-say?"]},"look-and-say?":{category:"number-theory",description:"Checks if a string is a valid Look-and-Say term.",returns:{type:"boolean"},args:{term:{type:"string",description:"The term to check."}},variants:[{argumentNames:["term"]}],examples:['let { look-and-say? } = import(number-theory);\nlook-and-say?("111221")','let { look-and-say? } = import(number-theory);\nlook-and-say?("123")'],seeAlso:["number-theory.look-and-say-seq","number-theory.look-and-say-nth","number-theory.look-and-say-take-while"]},"lucas-seq":{category:"number-theory",description:"Generates the lucas sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 77 (the maximum length of the pre-calculated Lucas numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { lucas-seq } = import(number-theory);\nlucas-seq(1)","let { lucas-seq } = import(number-theory);\nlucas-seq(2)","let { lucas-seq } = import(number-theory);\nlucas-seq()"],seeAlso:["number-theory.lucas-nth","number-theory.lucas-take-while","number-theory.lucas?","number-theory.fibonacci-seq"]},"lucas-take-while":{category:"number-theory",description:"Generates the lucas sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { lucas-take-while } = import(number-theory);\nlucas-take-while(-> $ < 100)"],seeAlso:["number-theory.lucas-seq","number-theory.lucas-nth","number-theory.lucas?"]},"lucas-nth":{category:"number-theory",description:"Generates the nth term of the lucas sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { lucas-nth } = import(number-theory);\nlucas-nth(1)","let { lucas-nth } = import(number-theory);\nlucas-nth(2)","let { lucas-nth } = import(number-theory);\nlucas-nth(10)"],seeAlso:["number-theory.lucas-seq","number-theory.lucas-take-while","number-theory.lucas?"]},"lucas?":{category:"number-theory",description:"Determines if a number is in the lucas sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { lucas? } = import(number-theory);\nlucas?(1)","let { lucas? } = import(number-theory);\nlucas?(2)","let { lucas? } = import(number-theory);\nlucas?(10)"],seeAlso:["number-theory.lucas-seq","number-theory.lucas-nth","number-theory.fibonacci?","number-theory.lucas-take-while"]},"lucky-seq":{category:"number-theory",description:"Generates the lucky sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { lucky-seq } = import(number-theory);\nlucky-seq(1)","let { lucky-seq } = import(number-theory);\nlucky-seq(2)","let { lucky-seq } = import(number-theory);\nlucky-seq(20)"],seeAlso:["number-theory.lucky-nth","number-theory.lucky-take-while","number-theory.lucky?","number-theory.happy-seq","number-theory.prime-seq"]},"lucky-take-while":{category:"number-theory",description:"Generates the lucky sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { lucky-take-while } = import(number-theory);\nlucky-take-while(-> $ < 100)"],seeAlso:["number-theory.lucky-seq","number-theory.lucky-nth","number-theory.lucky?"]},"lucky-nth":{category:"number-theory",description:"Generates the nth term of the lucky sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The position in the sequence."}},variants:[{argumentNames:["n"]}],examples:["let { lucky-nth } = import(number-theory);\nlucky-nth(1)","let { lucky-nth } = import(number-theory);\nlucky-nth(2)","let { lucky-nth } = import(number-theory);\nlucky-nth(20)"],seeAlso:["number-theory.lucky-seq","number-theory.lucky-take-while","number-theory.lucky?"]},"lucky?":{category:"number-theory",description:"Checks if a number is a lucky number.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { lucky? } = import(number-theory);\nlucky?(4)","let { lucky? } = import(number-theory);\nlucky?(7)","let { lucky? } = import(number-theory);\nlucky?(33)"],seeAlso:["number-theory.lucky-seq","number-theory.lucky-nth","number-theory.prime?","number-theory.lucky-take-while"]},"mersenne-seq":{category:"number-theory",description:"Generates the Mersenne sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 9 (the maximum length of the pre-calculated mersenne numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { mersenne-seq } = import(number-theory);\nmersenne-seq(1)","let { mersenne-seq } = import(number-theory);\nmersenne-seq(5)","let { mersenne-seq } = import(number-theory);\nmersenne-seq()"],seeAlso:["number-theory.mersenne-nth","number-theory.mersenne-take-while","number-theory.mersenne?","number-theory.prime-seq"]},"mersenne-take-while":{category:"number-theory",description:"Generates the Mersenne sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { mersenne-take-while } = import(number-theory);\nmersenne-take-while(-> $ < 1000)"],seeAlso:["number-theory.mersenne-seq","number-theory.mersenne-nth","number-theory.mersenne?"]},"mersenne-nth":{category:"number-theory",description:"Generates the nth term of the Mersenne sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { mersenne-nth } = import(number-theory);\nmersenne-nth(1)","let { mersenne-nth } = import(number-theory);\nmersenne-nth(5)"],seeAlso:["number-theory.mersenne-seq","number-theory.mersenne-take-while","number-theory.mersenne?"]},"mersenne?":{category:"number-theory",description:"Checks if a number is in the Mersenne sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { mersenne? } = import(number-theory);\nmersenne?(3)","let { mersenne? } = import(number-theory);\nmersenne?(4)","let { mersenne? } = import(number-theory);\nmersenne?(7)"],seeAlso:["number-theory.mersenne-seq","number-theory.mersenne-nth","number-theory.prime?","number-theory.mersenne-take-while"]},"padovan-seq":{category:"number-theory",description:"Generates the Padovan sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]}],examples:["let { padovan-seq } = import(number-theory);\npadovan-seq(5)","let { padovan-seq } = import(number-theory);\npadovan-seq(10)","let { padovan-seq } = import(number-theory);\npadovan-seq(20)"],seeAlso:["number-theory.padovan-nth","number-theory.padovan-take-while","number-theory.padovan?","number-theory.fibonacci-seq"]},"padovan-take-while":{category:"number-theory",description:"Generates the Padovan sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { padovan-take-while } = import(number-theory);\npadovan-take-while(-> $ < 1000)"],seeAlso:["number-theory.padovan-seq","number-theory.padovan-nth","number-theory.padovan?"]},"padovan-nth":{category:"number-theory",description:"Generates the nth term of the Padovan sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { padovan-nth } = import(number-theory);\npadovan-nth(5)","let { padovan-nth } = import(number-theory);\npadovan-nth(10)","let { padovan-nth } = import(number-theory);\npadovan-nth(20)"],seeAlso:["number-theory.padovan-seq","number-theory.padovan-take-while","number-theory.padovan?"]},"padovan?":{category:"number-theory",description:"Checks if a number is in the Padovan sequence.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { padovan? } = import(number-theory);\npadovan?(1)","let { padovan? } = import(number-theory);\npadovan?(265)","let { padovan? } = import(number-theory);\npadovan?(6)"],seeAlso:["number-theory.padovan-seq","number-theory.padovan-nth","number-theory.fibonacci?","number-theory.padovan-take-while"]},"partition-seq":{category:"number-theory",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).",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { partition-seq } = import(number-theory);\npartition-seq(1)","let { partition-seq } = import(number-theory);\npartition-seq(10)","let { partition-seq } = import(number-theory);\npartition-seq()"],seeAlso:["number-theory.partition-nth","number-theory.partition-take-while","number-theory.partition?","number-theory.partitions","number-theory.count-partitions"]},"partition-take-while":{category:"number-theory",description:"Generates the partition numbers while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { partition-take-while } = import(number-theory);\npartition-take-while(-> $ < 1000)"],seeAlso:["number-theory.partition-seq","number-theory.partition-nth","number-theory.partition?"]},"partition-nth":{category:"number-theory",description:"Generates the nth term of the partition numbers.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the partition number to generate."}},variants:[{argumentNames:["n"]}],examples:["let { partition-nth } = import(number-theory);\npartition-nth(1)","let { partition-nth } = import(number-theory);\npartition-nth(5)"],seeAlso:["number-theory.partition-seq","number-theory.partition-take-while","number-theory.partition?"]},"partition?":{category:"number-theory",description:"Checks if a number is in the partition numbers.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { partition? } = import(number-theory);\npartition?(0)","let { partition? } = import(number-theory);\npartition?(1)","let { partition? } = import(number-theory);\npartition?(2)","let { partition? } = import(number-theory);\npartition?(3)","let { partition? } = import(number-theory);\npartition?(4)","let { partition? } = import(number-theory);\npartition?(5)"],seeAlso:["number-theory.partition-seq","number-theory.partition-nth","number-theory.partitions","number-theory.partition-take-while"]},"pell-seq":{category:"number-theory",description:"Generates the Pell sequence up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",description:"The length of the sequence to generate. If not provided, the default is 42 (the maximum length of the pre-calculated Pell numbers)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { pell-seq } = import(number-theory);\npell-seq(5)","let { pell-seq } = import(number-theory);\npell-seq(10)","let { pell-seq } = import(number-theory);\npell-seq()"],seeAlso:["number-theory.pell-nth","number-theory.pell-take-while","number-theory.pell?","number-theory.fibonacci-seq"]},"pell-take-while":{category:"number-theory",description:"Generates the Pell sequence while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index and returns a boolean."}},variants:[{argumentNames:["takeWhile"]}],examples:["let { pell-take-while } = import(number-theory);\npell-take-while(-> $ < 1000)"],seeAlso:["number-theory.pell-seq","number-theory.pell-nth","number-theory.pell?"]},"pell-nth":{category:"number-theory",description:"Generates the nth term of the Pell sequence.",returns:{type:"integer"},args:{n:{type:"integer",description:"The index of the term to generate."}},variants:[{argumentNames:["n"]}],examples:["let { pell-nth } = import(number-theory);\npell-nth(5)","let { pell-nth } = import(number-theory);\npell-nth(10)","let { pell-nth } = import(number-theory);\npell-nth(20)"],seeAlso:["number-theory.pell-seq","number-theory.pell-take-while","number-theory.pell?"]},"pell?":{category:"number-theory",description:"Checks if a number is a Pell number.",returns:{type:"boolean"},args:{n:{type:"integer",description:"The number to check."}},variants:[{argumentNames:["n"]}],examples:["let { pell? } = import(number-theory);\npell?(1)","let { pell? } = import(number-theory);\npell?(470832)","let { pell? } = import(number-theory);\npell?(10)"],seeAlso:["number-theory.pell-seq","number-theory.pell-nth","number-theory.fibonacci?","number-theory.pell-take-while"]},"perfect-seq":{category:"number-theory",description:"Generates the perfect numbers up to a specified length.",returns:{type:"integer",array:!0},args:{length:{type:"integer",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)."}},variants:[{argumentNames:["length"]},{argumentNames:[]}],examples:["let { perfect-seq } = import(number-theory);\nperfect-seq(1)","let { perfect-seq } = import(number-theory);\nperfect-seq(5)","let { perfect-seq } = import(number-theory);\nperfect-seq()"],seeAlso:["number-theory.perfect-nth","number-theory.perfect-take-while","number-theory.perfect?","number-theory.abundant-seq","number-theory.deficient-seq","number-theory.amicable?"]},"perfect-take-while":{category:"number-theory",description:"Generates the perfect numbers while a condition is met.",returns:{type:"integer",array:!0},args:{takeWhile:{type:"function",description:"A function that takes an integer and an index a