Home Prime Calculator
12 factors as 2 × 2 × 3, joining those digits gives 223, and 223 is prime, so the home prime of 12 is 223. Enter any starting value from 2 up to one trillion to see the whole chain. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 12
- Home prime
- 223
- Iterations
- 1
- Sequence
- 12, 223
A home prime is reached by factoring a composite integer, writing its prime factors in ascending order without separators, and repeating that operation on the resulting integer until it is prime. This calculator performs that exact sequence for a starting value, reports every intermediate integer, and identifies how many transformations were required. It also applies explicit iteration and arithmetic limits so difficult or unusually long sequences fail clearly instead of consuming unbounded computation.
How factor concatenation creates the sequence
Begin with an integer greater than one. If it is already prime, it is its own home prime and the calculation ends with zero iterations. Otherwise, decompose it completely into prime factors, preserving repeated factors and arranging them from smallest to largest.
Remove multiplication signs and spaces, then read the adjacent decimal digits as the next integer. For example, twelve factors as two times two times three, so its next value is 223. Because 223 is prime, that sequence finishes immediately after one transformation.
Ordering matters: the standard home-prime process uses nondecreasing prime factors, making the result reproducible rather than dependent on how a factorization happened to be discovered. The response includes the final home prime as a decimal string, the number of factor-and-concatenate transformations, and the full sequence beginning with the supplied value. No randomness, external lookup, or stored table determines the answer.
Understanding limits and error results
Home-prime trajectories can grow quickly, and some starting values lead to intermediate composites that are substantially harder to factor than the original input. This calculator therefore treats bounded execution as part of its mathematical contract. The starting integer must be between two and one trillion, while each generated value must remain within the supported unsigned 64-bit range.
You may choose an iteration ceiling from one through twenty; the default is twenty. A separate clear error is returned if factorization work or an intermediate value exceeds its safety limit. These outcomes do not claim that a home prime does not exist.
They say only that the requested trajectory was not completed inside the calculator's published computational envelope. Raising the option up to twenty can help when a deliberately smaller ceiling was selected, but it cannot bypass the arithmetic bounds designed to keep execution predictable.
Reading and checking the returned result
Use the sequence as an audit trail rather than treating the final number as an unexplained answer. Each neighboring pair represents one complete operation: factor the earlier composite into primes, sort those factors, concatenate their decimal forms, and obtain the later value. The iterations field equals the number of such transitions, so it is always one less than the sequence length.
When comparing results from another program, confirm that it retains multiplicities, sorts factors numerically rather than lexicographically, and concatenates decimal representations without separators.
What you can do with it
Explore recreational number theory
Trace how a chosen composite evolves under repeated prime-factor concatenation and discover its terminal prime.
Build verified teaching examples
Use the complete sequence to demonstrate factorization, multiplicity, ordering, concatenation, and primality in one exercise.
Test another implementation
Compare every intermediate decimal string and the iteration count against a deterministic reference result.
FAQ
Is a prime input allowed?
Yes. A prime input is returned as its own home prime with zero iterations and a one-entry sequence.
Does a limit error mean no home prime exists?
No. It only means the sequence was not completed within the selected iteration ceiling or supported computation range.
How are repeated factors handled?
Every occurrence is retained. For example, twelve uses the factors 2, 2, and 3, producing 223.
What is the home prime of 12?
It is 223. 12 factors into 2, 2 and 3; written side by side in ascending order they form 223, which is already prime, so the chain ends after a single step.
Why does the order of the factors matter?
Joining the same factors in a different order gives a different number. The standard process always writes the prime factors from smallest to largest, so everyone who starts from the same value gets the same chain.
Related tools
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/home-prime \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":12}'const res = await fetch("https://api.kit.forhosting.com/numth/home-prime", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 12
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/home-prime",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 12
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/home-prime", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":12}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":12}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/home-prime", 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": 12
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.home_prime",
"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
max_iterations | 20 |
max_n | 1000000000000 |
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. |
Technical notes
How factor concatenation creates the sequence
Decimal strings preserve exact integers in JSON even when an intermediate value grows beyond the range that browser numbers can safely represent.
Understanding limits and error results
If the sequence has not reached a prime after that many transformations, the request returns an invalid-input error explaining that the safe iteration bound was exceeded.
Reading and checking the returned result
The last entry is identical to home_prime and has passed a deterministic primality test appropriate to the supported 64-bit domain. For API automation, treat home_prime and sequence entries as strings; converting them to ordinary floating-point numbers can lose precision. A successful result proves completion within the stated bounds, while a typed error gives a stable signal that callers can handle without mistaking a resource limit for a mathematical conclusion.
Technical questions
What does the calculator cost?
Each API request costs $0.002; the browser version can run the same deterministic logic locally.
Why are output values strings?
Intermediate integers can exceed JavaScript's exact numeric range, so decimal strings preserve every digit in JSON.