Moran number checker
Check whether a number divided by its digit sum gives a prime: 18 has digit sum 9, 18 divided by 9 is 2, and 2 is prime, so 18 is a Moran number. Each step is shown, so a no is explained too. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 18
- Digit sum
- 9
- Quotient
- 2
A Moran number is a positive integer that becomes a prime number when divided by the sum of its decimal digits. This checker performs each part of that definition explicitly: it calculates the digit sum, verifies that the division is exact, tests the resulting integer quotient for primality, and returns the final classification. The calculation is deterministic and uses integer arithmetic throughout.
What the Moran number test means
The Moran property connects decimal notation with prime numbers. Start with a positive integer n, add its decimal digits, and divide n by that sum. The original number qualifies only when the division produces an integer and that integer is prime.
For example, 18 has digit sum 1 + 8 = 9. Dividing 18 by 9 gives 2, and 2 is prime, so 18 is a Moran number. Every condition matters.
If the division leaves a remainder, there is no integer quotient to test and the number is not Moran. If the division is exact but its quotient is 1 or composite, the result is also false. The quotient is omitted when division is not exact because a fractional value is outside the definition.
The number one is valid input but is not Moran: its digit sum and quotient are both one, which is not prime.
How the checker produces an exact result
The solver reads n as one complete decimal integer. After parsing, the solver walks the canonical decimal representation once to obtain the digit sum. Because accepted inputs are positive, that sum cannot be zero.
A remainder operation then decides whether the quotient is integral. Only an exact quotient reaches the primality test. Values below two are not prime, two is handled directly, and other even values are rejected immediately.
For an odd candidate, the algorithm tries odd divisors only while the divisor is no greater than the candidate divided by itself. This integer comparison avoids relying on a rounded square root and guarantees termination within a finite bound. Finding any divisor proves the quotient composite; exhausting the bound proves it prime.
Using the result for learning, validation, and datasets
Moran numbers are useful in recreational number theory because a simple digit operation leads to a genuine primality condition. In a lesson, students can calculate the digit sum, predict whether division will be exact, and factor the quotient before comparing their work with the structured response. This makes the checker a verification aid while preserving the intermediate facts needed to explain the answer.
Since quotient is present only when it is mathematically applicable, typed clients do not have to interpret an ambiguous null or a decimal approximation. For a bounded sequence study, submit candidates from your own controlled loop and retain responses whose moran field is true.
What you can do with it
Check number theory exercises
Verify a proposed Moran number while retaining the digit sum, divisibility result, and prime quotient that justify the classification.
Label integer records
Add an explainable Moran-number flag and its intermediate arithmetic to individual values in a validation or enrichment pipeline.
FAQ
What is a Moran number?
It is a positive integer that, when divided exactly by the sum of its decimal digits, produces a prime integer quotient.
Is 18 a Moran number?
Yes. Its digit sum is 9, and 18 divided by 9 is 2, which is prime.
What if the division is not exact?
The number is not Moran. The response sets divisible and moran to false and omits quotient because no integer quotient applies.
Is 1 a Moran number?
No. Its digit sum is 1 and the quotient is also 1, which is not a prime. You can still enter 1; the result simply explains why it does not qualify.
What if the division is exact but the quotient is not prime?
Then the number is not a Moran number either. The result shows the digit sum, confirms the division is exact and states that the quotient is 1 or composite, so you see exactly where it failed.
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/moran-number \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":18}'const res = await fetch("https://api.kit.forhosting.com/numth/moran-number", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 18
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/moran-number",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 18
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/moran-number", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":18}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":18}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/moran-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": 18
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.moran_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.
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
Run it free in the browser for individual exploration or call the API for $0.002 per successful request.
What the Moran number test means
The response exposes these stages through digit_sum, divisible, the optional quotient, quotient_is_prime, and moran. That structure explains a negative result rather than returning only a bare yes or no. Inputs below one produce invalid_input instead of a mathematical classification.
How the checker produces an exact result
It accepts safe JSON integers and whole decimal integer strings, while rejecting fractions, scientific notation, infinity, missing values, and integers outside JavaScript's safe range. This boundary ensures that decimal digits, remainders, and quotients retain exact integer meaning. No network request, random value, retained state, model output, or current time affects the calculation, so identical input produces identical JSON in both the browser and API paths.
Using the result for learning, validation, and datasets
The divisible field distinguishes numbers that fail before primality from those that yield a composite integer quotient, and quotient_is_prime provides a direct Boolean for filtering. This capability evaluates one supplied value per request; it does not enumerate ranges, guess likely examples, or claim that every number divisible by its digit sum is Moran.
Integration use cases
Test sequence generators
Use deterministic positive and negative results as regression fixtures for software that generates or filters recreational integer sequences.
Technical questions
What happens when n is below one?
The request fails with invalid_input because the checker accepts positive integers only.
How much does an API request cost?
Each successful API request costs $0.002. The same deterministic calculation can also run free in your browser.