Extravagant number checker
Four is extravagant because its factorization, 2², takes two digits while 4 takes only one. Enter any whole number from 2 up and see both digit counts side by side with the verdict: extravagant, equidigital or economical. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 4
- N digits
- 1
- Factorization digits
- 2
- Factorization
- 2^2
- Classification
- extravagant
An extravagant number (also called a wasteful number in recreational number theory) is a natural number n whose prime factorization writing uses strictly more decimal digits than the decimal representation of n itself. Only digits of the primes and of exponents greater than one are counted; multiplication signs and carets are ignored. For example four factors as two squared: the factorization uses two digits while four itself uses one, so four is extravagant. Six factors as two times three for two digits versus one digit in six, so six is also extravagant. Ten factors as two times five for two digits matching the two digits of ten, so ten is equidigital rather than extravagant. The engine never calls the network, never samples randomness, and never depends on the clock, so the same n always yields the same answer.
What makes a number extravagant, and what you see
Number theorists partition positive integers into three digit-efficiency classes by comparing the length of n in decimal with the total number of digits appearing when the prime factorization of n is written in the usual compact form. Count every digit of each prime factor. When a prime appears to a power greater than one, also count every digit of that exponent; exponent one is omitted from the written product and therefore contributes zero digits.
Symbols such as multiplication dots and caret signs do not count. If the factorization digit total is greater than the digit length of n, the number is extravagant (wasteful). If the totals are equal, the number is equidigital.
If the factorization is shorter, the number is economical. Classic extravagant examples include four (two squared: two digits versus one), six (two times three: two versus one), eight (two to the three: two versus one), nine (three squared: two versus one), and twelve (two squared times three: three versus two). Equidigital examples include every prime (the factorization is the prime itself) and ten (two times five: two versus two).
Economical examples appear once numbers grow large enough that a short prime-power product packs more magnitude than digit length. Non-extravagant integers are successful responses with extravagant false; they are not errors. If you need only the prime powers of an integer without the digit-efficiency comparison, use a dedicated prime-factorization tool; this page answers the extravagant-number question with both digit counts side by side.
How inputs are read and how digit counts stay exact
Optional leading plus signs are allowed for positive values; embedded spaces, hex prefixes, and exponential notation are rejected so a bad cell does not become a wrong flag. Negative integers and values below two are rejected because the extravagant classification here is defined on integers starting at two, matching the domain of prime factorization. The engine stays inside JavaScript safe integers, which is more than enough for classroom problems, programming contests, and most applied checks on moderately large n.
Internally the number is factored by trial division: remove factors of two, then walk odd candidates up through the square root of the remaining cofactor, and finish with any leftover prime greater than one. Digit counts use repeated division by ten on non-negative values, so there is no floating-point step that could round a near-boundary into a false extravagant claim.
For each prime power p to the e the factorization digit total adds the decimal length of p, and when e is greater than one it also adds the decimal length of e. The length of n is the same digit walk applied to n itself.
Where extravagant checks fit in study, research demos, and code
Students meet extravagant, equidigital, and economical numbers when exploring recreational number theory next to Smith numbers, perfect numbers, and harshad numbers. Teachers can generate answer keys for worksheets without trusting opaque calculator apps that hide how exponents enter the digit tally. Developers use the same contract to validate sample data for number-theory libraries, to gate property tests on random integer generators, or to pre-check that a seed sits in the extravagant class before a demonstration step.
Contest practice often needs a fast offline source of extravagant answers so solutions can be checked without downloading OEIS tables for wasteful numbers. Pair it with prime factorization when you need only the prime powers, with a Smith-number checker when you need digit-sum equality rather than digit-count comparison, and with an abundant-number checker when you need divisor-sum classification instead of factorization length.
What you can do with it
Homework and contest classification
Decide whether integers are extravagant, equidigital, or economical by comparing factorization digit length to the length of n without factoring by hand.
Teaching digit-efficiency curiosities
Show students how prime-power writing can use more digits than n itself while they change n live in the browser at no cost.
FAQ
What does the extravagant number checker cost?
It is free in your browser on this page.
What happens if n is below 2?
Extravagant numbers are defined here for integers n ≥ 2, where prime factorization is meaningful in the usual sense.
How are factorization digits counted?
Factor n into primes. Add the decimal digit count of each prime. When an exponent is greater than one, also add the digit count of that exponent. Multiplication and caret symbols are not counted.
Is the algorithm randomized?
No. It uses deterministic trial division and exact digit counts. The same n always yields the same factors, digit totals, and extravagant flag.
How is this different from a Smith number checker?
A Smith checker compares digit sums of n and of its prime factors with multiplicity. This tool compares digit lengths: whether writing the prime factorization uses more digits than writing n itself.
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/extravagant-number \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":4}'const res = await fetch("https://api.kit.forhosting.com/numth/extravagant-number", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/extravagant-number",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/extravagant-number", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/extravagant-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": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.extravagant_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
This checker accepts an integer n at least two, factors it by deterministic trial division, counts both digit totals, and returns a boolean extravagant flag together with the full classification, the factors, and a compact factorization string.
What extravagant numbers are and what the response contains
This endpoint always returns the parsed n, n_digits, factorization_digits, the ascending list of prime-power pairs as base and exponent, a compact factorization string using middle-dot separators, the boolean extravagant true only when factorization_digits exceeds n_digits, and classification as one of extravagant, equidigital, or economical. Values below two, non-integers, fractions, scientific notation, and values outside the safe integer range fail with invalid_input and a clear message.
How inputs are read and how digit counts stay exact
The preferred field is n as a JSON integer, but decimal strings and the aliases number or value are accepted so forms, spreadsheets, and query strings can reuse one contract.
Where extravagant checks fit in study, research demos, and code
On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result.
Integration use cases
Deterministic test fixtures
Generate reproducible extravagant and non-extravagant samples for unit tests, property checks, and CI assertions without embedding static OEIS dumps.