ForHosting KIT · Math

Number of divisors calculator

12 has 6 divisors: it factors as 2² × 3, so the count is (2+1) × (1+1) = 6. Enter any positive whole number and get its number of divisors together with the prime powers behind it. 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
12
You get
Divisor count
6
Tau
6

The number of positive divisors of an integer n, written τ(n) or d(n), appears in contest problems, cryptography homework, and anytime you need to know how many ways a quantity factors into whole parts. This calculator obtains τ(n) from the prime factorization of n: if n equals a product of prime powers, the count is the product of each exponent plus one.

Why prime factorization beats listing every divisor

A naive loop from one through n (or even through the square root) can find each divisor by testing remainder zero, but that approach only becomes practical after you have already decided to materialize the full list. When the question is simply how many divisors exist, number theory gives a closed multiplicative formula that needs only the prime factorization. Write n as p1 to the power e1 times p2 to the power e2 and so on.

Then every divisor is formed by choosing, for each prime, an exponent between zero and ei inclusive, which yields ei plus one choices per prime. Multiplying those independent choices produces τ(n) without ever building the list. For highly composite values the list would be long; the count remains a short integer product.

The factorization is returned alongside the count so you can audit the arithmetic yourself or teach the identity in a classroom.

Where the divisor count fits in real work

Contest programmers use τ(n) as a building block for highly composite searches, abundance classification, and sieve-based tables. Teachers assign factorization-to-divisor exercises and need a deterministic oracle that shows the intermediate primes, not a black-box answer. Data engineers sometimes need the count of factor pairs when sizing chunk layouts or validating that a grid dimension admits an expected set of tile sizes.

Use the browser tool to check homework quickly, then automate the identical contract when your service needs bulk checks. If you later need the full list of divisors or the sum-of-divisors function σ(n), treat those as separate intents rather than overloading this count-focused landing.

Contest and homework checks

Verify τ(n) for olympiad problems and factorization worksheets, with the prime powers shown so the product of (e+1) can be inspected.

Factor-pair sizing

Confirm how many ordered or unordered factor pairs a dimension admits when planning grids, tiles, or block layouts.

What is τ(n), the number of divisors?

τ(n) (also d(n)) is the count of positive integers that divide n evenly. If n = p1^e1 × … × pk^ek, then τ(n) = (e1+1)×…×(ek+1).

Does this list every divisor?

No. It returns the count and the prime factorization used to compute it. Listing every divisor is a different task.

Why is τ(1) equal to 1?

The only positive divisor of 1 is 1 itself. With an empty prime factorization the product of (e+1) terms is the empty product, which equals 1.

What does it cost?

The browser tool is free and runs locally.

How many divisors does 12 have?

It has 6. Write 12 as 2² × 3, add one to each exponent and multiply: (2+1) × (1+1) = 6. You do not need to list the divisors to know how many there are.

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/numth/divisor-count

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/numth/divisor-count \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":12}'
{
  "n": 12
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.divisor_count",
  "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.

min_n1
max_n9007199254740991
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.

Why prime factorization beats listing every divisor

This endpoint implements that standard algorithm: trial division factors the input safely within JavaScript integer limits, then multiplies the (exponent plus one) terms.

What you send and what you get back

For n equals one the factorization is empty and the count is one, matching the empty-product convention used throughout analytic number theory. Typical checks: twelve factors as two squared times three and therefore has (2+1)×(1+1)=6 divisors; a prime p has τ(p)=2; a prime power p^k has exactly k+1 divisors. Provide a positive integer n (aliases number and value are accepted). Values below one, non-integers, empty fields, and numbers larger than the platform safe-integer maximum are rejected with invalid_input and are not charged. On success the response includes the normalized n, divisor_count, the alias field tau with the same value, and factorization as an ordered array of prime and exponent objects.

Where the divisor count fits in real work

Because the capability is a pure parse engine, there is no model drift, no network dependency, and no stored state: the same n always yields the same JSON. API pricing is the published base of $0.002 per successful item; failed validation does not consume balance.

Pipeline-friendly number theory

Call the same deterministic contract from scripts and CI so divisor-count fixtures never depend on a spreadsheet or a casual web form.

What values of n are accepted?

Integers from 1 through 9007199254740991 (Number.MAX_SAFE_INTEGER). Zero, negatives, decimals, and non-numeric strings fail with invalid_input.

Read the full KIT documentation →