# Number Sequences API
> Generate famous integer sequences and test membership, with exact big-integer maths. The generate endpoint returns the first N terms of a sequence — Fibonacci, Lucas, prime numbers, triangular, square, cube, factorial, Catalan, pentagonal and tetrahedral numbers, plus parameterised arithmetic (a start and a step), geometric (a start and a ratio) and powers (any base). The contains endpoint tells you whether a given number belongs to a sequence — is 233 a Fibonacci number, is 21 triangular, is 97 prime, is 720 a factorial — using fast closed-form tests for primes, squares, cubes, triangular, pentagonal and Fibonacci numbers and an exact search for the rest, and it returns the term index where it is known. Because everything is computed with arbitrary-precision integers, terms beyond the usual floating-point limit are returned exactly as decimal strings and never overflow. It runs entirely locally, so it is instant, deterministic and private. Ideal for education and maths tooling, coding challenges and puzzles, test-data generation, recreational mathematics and number-theory experiments. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This generates and tests integer sequences; to factorize a single number or get its divisors use a number-theory API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/sequences-api/..."
```

## Pricing
- **Free** (Free) — 2,835 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 12,350 calls/Mo, 8 req/s
- **Pro** ($24/Mo) — 174,500 calls/Mo, 20 req/s
- **Mega** ($62/Mo) — 915,000 calls/Mo, 50 req/s

## Endpoints

### Sequences

#### `GET /v1/contains` — Test membership

**Parameters:**
- `sequence` (query, required, string) — The sequence name Example: `fibonacci`
- `value` (query, required, string) — The integer to test Example: `233`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sequences-api/v1/contains?sequence=fibonacci&value=233"
```

**Response:**
```json
{
    "data": {
        "value": "233",
        "contains": true,
        "sequence": "fibonacci"
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:02.621Z",
        "request_id": "b01c8eb1-72f1-41c6-953a-27fa4ec2e9fe"
    },
    "status": "ok",
    "message": "Test membership",
    "success": true
}
```

#### `GET /v1/generate` — Generate a sequence

**Parameters:**
- `sequence` (query, required, string) — fibonacci, lucas, primes, triangular, square, cube, factorial, catalan, pentagonal, tetrahedral, arithmetic, geometric, powers Example: `fibonacci`
- `count` (query, optional, string) — How many terms (default 10, max 1000) Example: `10`
- `start` (query, optional, string) — arithmetic/geometric start
- `step` (query, optional, string) — arithmetic step
- `ratio` (query, optional, string) — geometric ratio
- `base` (query, optional, string) — powers base

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sequences-api/v1/generate?sequence=fibonacci&count=10"
```

**Response:**
```json
{
    "data": {
        "count": 10,
        "terms": [
            0,
            1,
            1,
            2,
            3,
            5,
            8,
            13,
            21,
            34
        ],
        "sequence": "fibonacci"
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:02.726Z",
        "request_id": "3a8c06b7-ee2c-4a01-ad7b-259f14fc5519"
    },
    "status": "ok",
    "message": "Generate a sequence",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sequences-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "name": "Number Sequences API",
        "notes": "Terms beyond 2^53 are returned as decimal strings to stay exact. Membership uses closed forms for primes, squares, cubes, triangular, pentagonal and Fibonacci; other sequences are searched up to a large cap. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/generate",
                "params": {
                    "base": "powers base",
                    "step": "arithmetic step",
                    "count": "how many terms (default 10, max 1000)",
                    "ratio": "geometric ratio",
                    "start": "arithmetic/geometric start",
                    "sequence": "fibonacci, lucas, primes, triangular, square, cube, factorial, catalan, pentagonal, tetrahedral, arithmetic, geometric, powers"
                },
                "returns": "the sequence terms"
            },
            {
                "path": "/v1/contains",
                "params": {
                    "value": "the integer to test",
                    "sequence": "the sequence name"
                },
                "returns": "whether the number is in the sequence (and its index when known)"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Generate famous integer sequences and test membership, with exact big-i
…(truncated, see openapi.json for full schema)
```


---
Marketplace page: https://www.oanor.com/api/sequences-api
OpenAPI spec: https://www.oanor.com/api/sequences-api/openapi.json
