ForHosting KIT · Math

Divisor calculator

28 has exactly six divisors, and you get every one of them in ascending order, from 1 to 28 itself, together with the count. Enter any whole number up to a trillion to see whether it is prime or how it splits evenly. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
28
You get
Quantity
6
Divisors
1, 2, 4, 7, 14, 28

Divisors are the backbone of elementary number theory: they decide whether a number is prime, how a quantity can be split into equal parts, and what simplify a fraction, a ratio or a schedule. Instead of testing candidates one by one in a spreadsheet or a script, you send one number and receive the complete, exact answer in a single deterministic call. The same code that answers here runs free in your browser on this page.

What a divisor is and why the full list matters

A divisor of a number n is any positive integer d such that n divided by d leaves no remainder. Every number has at least two of them — one and itself — and primes have exactly those two.

Knowing the divisors of a number in full, not just whether one particular candidate divides it, unlocks most questions people actually ask about integers: whether n is prime, what its greatest common divisor with another number can be, into how many equal groups a quantity can be split, or which denominators make a fraction terminate. A partial answer forces you to keep guessing; a complete, sorted list settles the question in one read.

How the list is computed

The algorithm is trial division up to the square root of n, which is the classic exact method for this problem. Divisors come in pairs: whenever a small number i divides n, the quotient n/i is also a divisor, so the loop only has to reach the square root to discover every divisor in the set.

Each pass collects the small half of each pair in ascending order and the large half in descending order, and joining the two halves yields the final list already sorted, with no extra sorting step and no floating point involved. The running time grows with the square root of the input, so even a number in the billions is answered in milliseconds, and the published upper bound keeps the worst case firmly inside a free-tier request.

Check whether a number is prime

A number with exactly two divisors — one and itself — is prime. The count field answers the question directly, and the list shows the smallest factor when it is not.

Split a quantity into equal groups

Find every team size, batch length or package count that divides an inventory exactly, without remainder, before committing to a layout.

Prepare a number theory exercise

Generate the worked answer for divisor exercises — the complete list and the count — to check homework or to seed examples for a lesson.

What does it cost?

The same computation is also free to run in your browser on this page.

What input does it accept?

A single positive integer in the field n, up to a published maximum of 1000000000000.

What exactly is returned?

An object with n (the number you sent), count (how many divisors it has) and divisors (the complete list, sorted ascending).

Does it only find proper divisors?

No. The list includes 1 and the number itself, so it is the complete set of positive divisors, not just the proper ones.

Can I use it to test primality?

Yes. If the count is exactly 2, the number is prime; if it is 1, the number is 1; anything higher means the number is composite.

Is the result always identical for the same input?

Yes. The computation is pure integer arithmetic with no randomness, clocks or network, so the same n always yields the same response.

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.

POSThttps://api.kit.forhosting.com/math/divisor

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.

curl -X POST https://api.kit.forhosting.com/math/divisor \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":28}'
{
  "n": 28
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.divisor",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_n1000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The divisor API takes a single positive integer and returns every positive integer that divides it exactly, as a sorted list together with the total count.

What a divisor is and why the full list matters

That is why this endpoint returns the entire set rather than a yes-or-no check, and why it also returns the count, since the number of divisors alone classifies numbers into primes, composites and the rare highly composite ones that pack many divisors into a small value.

How the list is computed

Because the computation is pure integer arithmetic with no randomness, no clocks and no network, the same input always produces byte-for-byte the same output, which is what lets the free browser version on this page promise exactly what the paid API charges for.

Validation, limits and errors

There is no pagination and no truncation — the list is always complete for any accepted input. The endpoint accepts one field, n, which must be a positive integer. Zero and negative numbers are rejected because divisibility is defined here over positive integers, and non-integers such as 12.5 are rejected because the concept of an exact divisor does not apply to them; values above the published limit are rejected to keep every request inside its budgeted cost. Each rejection comes back as a structured invalid_input error that says precisely which rule was broken, so a calling pipeline can surface a useful message instead of a generic failure. Valid input returns a single JSON object with three fields: n echoes the number you sent, count is the total number of divisors, and divisors is the complete sorted list. It runs on our global edge with nothing stored afterwards, at $0.002 per request via API, and the identical computation runs free in your browser if you only need an occasional answer by hand.

Read the full KIT documentation →