MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / lookupSequence

Function lookupSequence

src/compute-engine/oeis.ts:267–288  ·  view source on GitHub ↗
(
  ce: ComputeEngine,
  terms: (number | Expression)[],
  options: OEISOptions = {}
)

Source from the content-addressed store, hash-verified

265// ============================================================================
266// ComputeEngine Integration
267// ============================================================================
268
269/**
270 * Look up a sequence in OEIS by its terms.
271 *
272 * @param ce - ComputeEngine instance
273 * @param terms - Array of sequence terms (numbers or BoxedExpressions)
274 * @param options - Optional configuration
275 * @returns Promise resolving to array of matching sequences
276 */
277export async function lookupSequence(
278 ce: ComputeEngine,
279 terms: (number | Expression)[],
280 options: OEISOptions = {}
281): Promise<OEISSequenceInfo[]> {
282 // Convert BoxedExpressions to numbers and validate all are integers
283 const numericTerms = terms.map((t) => {
284 if (typeof t === 'number') {
285 if (!Number.isInteger(t)) {
286 throw new Error('OEIS lookup requires integer terms');
287 }
288 return t;
289 }
290 const n = t.re;
291 if (!Number.isInteger(n)) {

Callers

nothing calls this directly

Calls 3

lookupOEISByTermsFunction · 0.85
mapMethod · 0.65
isIntegerMethod · 0.45

Tested by

no test coverage detected