Jordan totient calculator
With order 1, the Jordan totient of 36 is 12, the same as Euler’s totient. Choose a higher order k and the calculator applies n^k times the product of (1 − p^−k) over the primes of n, showing the factorization it used. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 36
- K
- 1
- Jordan
- 12
The Jordan totient function J_k(n) generalizes Euler's totient by counting k-tuples of integers modulo n that generate a free Z-module of rank k, or equivalently by the product formula n^k times the product over primes p dividing n of (1 minus p to the minus k). When the order k equals one, J_1(n) recovers φ(n) exactly. This calculator takes a positive integer n and a positive order k, factors n by deterministic trial division, and evaluates the classical prime-power product so you obtain an exact integer J_k(n) without floating-point drift or external services. Use it for homework checks, lattice-point counts, and number-theory pipelines that already trust exact arithmetic.
What the Jordan totient measures and why it matters
Euler's totient φ(n) counts residue classes modulo n that are coprime to n. Jordan's function lifts that count to higher rank: J_k(n) equals the number of k-tuples of integers in {1, …, n}^k that are relatively prime as a set to n in the sense that the greatest common divisor of all k coordinates together with n is one.
Equivalently, it is the order of the group of invertible k-by-k matrices over the ring of integers modulo n that can be reduced to elementary form, and it appears as the degree of the extension of the cyclotomic field when you study lattices and Dedekind zeta special values. For a prime power p to the a the closed form is p to the k times (a minus one) times (p to the k minus one), and multiplicativity over coprime factors yields the global product.
Engineers and contest authors meet J_k when they count free generators of modules, size unit groups of matrix rings over Z/nZ, or verify identities that reduce to φ when k is one. Returning both the totient value and the factorization that produced it removes a common source of off-by-one mistakes in homework checkers, CAS comparisons, and integer pipelines that would otherwise reimplement factorization ad hoc for each exercise.
How this calculator evaluates J_k(n) from prime factors
Call the capability with two positive integer fields: n and k. The implementation factors n with trial division by peeling off factors of two, then odd candidates up to the square root, and finally any remaining prime cofactor. From that ordered list it applies the exact integer form of Jordan's product: for every prime power p to the a dividing n, multiply the running result by p raised to k times (a minus one) times (p to the k minus one).
Powers are computed with arbitrary-precision integers so intermediate values stay exact, then the final result is required to fit in a JavaScript safe integer so clients receive a plain number. When k equals one the same path reproduces Euler's product formula, so J_1(n) matches φ(n) for every accepted n. The response includes n, k, jordan, the factor list as prime and exponent pairs, and a short formula string for documentation.
Practical use, limits, pricing, and delivery
Use the browser tool when you want an immediate answer while studying multiplicative number theory, checking a textbook identity that specializes to Euler's totient, or debugging a lattice-point count. Accepted ranges are n from one through one trillion and k from one through twenty, which cover typical contest, classroom, and application sizes while keeping trial division practical. Results are deterministic: the same n and k always yield the same jordan value and the same factor list.
There is no language model, no external factoring service, and no randomness, so the capability is safe to pin in automated tests.
What you can do with it
Homework and contest verification
Students and graders can confirm J_k(n) for arbitrary positive n and order k, inspect the prime factors used, and check that J_1 matches Euler's φ without a local CAS.
Lattice and module counting demos
Teaching materials on free Z-modules modulo n or unit groups of matrix rings can compute Jordan totients on demand and show factorization beside the result.
FAQ
What happens if n or k is less than 1?
The Jordan totient is defined for positive integers n and positive order k; zero and negatives are rejected and not charged.
How is J_k(n) related to Euler's totient?
When k equals 1, J_1(n) equals φ(n). For k greater than 1 the function counts a higher-rank coprimality condition via the product n^k · Π (1 − p^{−k}).
Is the Jordan totient calculator free?
The browser tool runs free on your device.
What are the largest n and k I can submit?
n may be from 1 through 1,000,000,000,000 (1e12) and k from 1 through 20. Combinations whose result exceeds the safe integer range are also rejected.
What does the Jordan totient count?
It counts the k-tuples of numbers from 1 to n whose coordinates, taken together with n, have greatest common divisor 1. With k equal to 1 that is exactly Euler’s totient, the count of numbers coprime to n.
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/jordan-totient \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":36,"k":1}'const res = await fetch("https://api.kit.forhosting.com/numth/jordan-totient", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 36,
"k": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/jordan-totient",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 36,
"k": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/jordan-totient", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":36,"k":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":36,"k":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/jordan-totient", 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": 36,
"k": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.jordan_totient",
"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_n | 1000000000000 |
max_k | 20 |
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 this calculator evaluates J_k(n) from prime factors
Inputs below one for either field, non-integers, missing fields, values above the published upper bounds, and combinations whose result would overflow the safe-integer range are rejected as invalid_input and are never charged.
Practical use, limits, pricing, and delivery
Use the API when a script, continuous-integration job, or educational platform needs J_k(n) for many pairs without shipping a factorization library. Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into number-theory demos, crypto teaching sandboxes that contrast φ with higher-order Jordan counts, or integer preprocessing steps where you already trust exact arithmetic more than approximate heuristics and need a single priced item per pair.
Integration use cases
Automated number-theory pipelines
Scripts that enumerate multiplicative identities, special values, or reduced k-tuples can call a single deterministic item-priced endpoint instead of embedding factorization code.
Technical questions
How do I compute the Jordan totient J_k(n) with this API?
Send a JSON body with positive integer fields n and k to the numth.jordan_totient capability. The response returns jordan, the ordered prime factorization, and a formula string.