Cullen number generator
The Cullen number generator calculates the term at index n in the sequence defined by C_n = n × 2^n + 1.
Run — free
Enter any supported non-negative integer and receive the complete decimal expansion, represented exactly rather than rounded to an ordinary floating-point value. This makes the tool useful for sequence study, classroom demonstrations, programming exercises, and reproducible number-theory experiments. The same deterministic calculation runs for every request, including the boundary term C_0 = 1.
Understand the Cullen number formula
A Cullen number combines an index with a power of two: C_n = n × 2^n + 1. The index n appears twice, first as the multiplier and again as the exponent, so terms grow much faster than a simple arithmetic or geometric sequence. For example, choosing n = 5 gives 5 × 32 + 1, while choosing n = 10 uses 10 × 1,024 + 1. The generator treats n as a zero-based index and therefore includes C_0 = 1. It accepts only whole, non-negative indices because a negative index would introduce a fractional power of two and would no longer belong to the intended integer sequence. The returned Cullen number is a decimal string. That representation is deliberate: large sequence terms quickly exceed the exact integer range of common JSON numbers, whereas a decimal string preserves every digit. You can display it directly, store it without precision loss, or convert it to an arbitrary-precision integer in software that supports such values.
Generate and interpret an exact result
Provide n as an integer field; the alias index is accepted for clients that use a more descriptive input name. The calculator validates the value before doing any arithmetic, rejecting missing values, decimals, negative integers, and indices beyond the published processing limit. It then computes 2^n with integer bit shifting, multiplies by n, adds one, and converts the final integer to base-ten text. No probabilistic shortcut, logarithmic approximation, or floating-point arithmetic is involved. The response contains the normalized numeric index and cullen_number, the exact decimal expansion of C_n. Keeping the index beside the value is helpful when results are queued, compared, or saved in a dataset because it prevents a large standalone integer from losing its sequence context. If you need to verify a small term manually, calculate the power of two first, multiply that value by n, and finally add one. For large terms, compare exact strings or arbitrary-precision integers rather than converting the response to a standard floating-point number, which could silently round its final digits.
Use Cullen numbers in study and software
Cullen numbers are a compact example of how elementary operations can create a rapidly growing integer sequence. In teaching, they connect exponentiation, multiplication, indexing, recurrence-free sequence definitions, and the practical limits of machine-number formats. In software testing, selected terms make useful fixtures for checking arbitrary-precision parsing, serialization, storage, and equality without relying on random data. In mathematical exploration, generated values can be passed to separate tools that test divisibility, factor integers, inspect residues, or investigate prime candidates. This capability only generates the sequence term; it does not claim that a result is prime and does not perform factorization. That separation keeps its contract clear and its output reproducible. Because the calculation uses no network, randomness, clock, or mutable state, the same valid n always produces the same decimal digits. When integrating through the API, budget one item per requested index and retain the returned string if downstream systems cannot represent large integers exactly. The API price is shown through $0.002, while the browser execution can support quick interactive checks.
What you can do with it
Explore an integer sequence
Generate exact Cullen terms for a table, lesson, sequence comparison, or number-theory notebook.
Test large-integer handling
Use deterministic decimal outputs to test arbitrary-precision parsing, serialization, database storage, and equality checks.
Prepare values for further analysis
Create a Cullen number before sending it to a separate primality, factorization, residue, or divisibility workflow.
FAQ
What is a Cullen number?
The term at index n is the integer C_n = n × 2^n + 1.
Can n be zero?
Yes. This generator uses a zero-based sequence, so C_0 = 0 × 2^0 + 1 = 1.
Why is the result returned as text?
A decimal string preserves every digit when the value exceeds the exact range of ordinary JSON numbers.
Does the generator test whether the result is prime?
No. It calculates the exact Cullen number only; primality testing and factorization are separate operations.
What happens when n is negative?
The request fails with an invalid-input error because Cullen sequence indices must be non-negative integers.
What does an API request cost?
Each request costs $0.002. Interactive browser execution is available for quick calculations.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/numth/cullen-number \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":5}'const res = await fetch("https://api.kit.forhosting.com/numth/cullen-number", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/cullen-number",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/cullen-number", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/cullen-number", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.cullen_number",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
min_n | 0 |
max_n | 100000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |