(
ce: ComputeEngine,
terms: (number | Expression)[],
options: OEISOptions = {}
)
| 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 | */ |
| 277 | export 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)) { |
nothing calls this directly
no test coverage detected