Dudeney number checker
512 is a Dudeney number: its digits add up to 8, and 8 cubed is 512. Enter any positive whole number to see its digit sum, whether it is a perfect cube, its cube root and the final verdict. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 512
- Digit sum
- 8
- Cube root
- 8
A Dudeney number is a positive integer with two linked properties: it is a perfect cube, and the sum of its decimal digits equals its integer cube root. This checker evaluates both conditions exactly and reports the digit sum, whether the input is a perfect cube, its cube root when one exists, and the final Dudeney classification.
What the Dudeney test means
The definition combines place-value arithmetic with a power relationship. Start with a positive integer n and add its decimal digits. Then ask whether n is the cube of that sum.
Equivalently, n must have an integer cube root, and that root must equal the digit sum. For 512, the digits add to eight and eight cubed is 512, so the result is a Dudeney number. A perfect cube can still fail: 1,000 has cube root ten, while its digits add to one.
A matching digit sum is also insufficient when the input is not a perfect cube. The number one is accepted and qualifies because its digit sum and cube root are both one.
How the checker calculates an exact answer
The input is read as a whole decimal integer. The digit sum is computed directly from the canonical decimal representation. To avoid treating a rounded floating-point cube root as exact, the checker searches the small bounded range of possible roots with integer comparisons and verifies candidate cubing with BigInt arithmetic.
Because every accepted input is a safe integer, its nonnegative cube root is below the fixed upper search bound. The algorithm therefore terminates after a small, predictable number of comparisons. Only the conjunction of both conditions sets dudeney to true.
What you can do with it
Verify number theory exercises
Check a student's proposed Dudeney number while preserving the digit sum and exact cube evidence used to reach the classification.
Classify integer records
Add an explainable Dudeney flag to individual integer records in a validation or enrichment pipeline.
FAQ
What is a Dudeney number?
It is a positive perfect cube whose decimal digit sum equals its integer cube root.
Is 512 a Dudeney number?
Yes. Its digits sum to 8, and 512 is exactly 8 cubed.
Is every perfect cube a Dudeney number?
No. A perfect cube qualifies only when its decimal digit sum also equals its cube root.
Is 1 a Dudeney number?
Yes. Its digit sum is 1 and its cube root is also 1, so both conditions hold. The checker accepts it and classifies it as a Dudeney number.
Why is 1000 not a Dudeney number?
Because only one of the two conditions holds. 1000 is a perfect cube with a cube root of ten, but its digits add up to one, and the two values must match.
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/dudeney-number \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":512}'const res = await fetch("https://api.kit.forhosting.com/numth/dudeney-number", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 512
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/dudeney-number",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 512
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/dudeney-number", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":512}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":512}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/dudeney-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": 512
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.dudeney_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
The calculation is deterministic, uses integer arithmetic for the cube test, and can run freely in your browser or through the API for $0.002 per successful request.
What the Dudeney test means
The response keeps these facts separate through digit_sum, is_perfect_cube, an optional cube_root, and dudeney. That structure makes a false result explainable instead of returning only a bare yes or no. Inputs below one are outside the promised domain and return invalid_input rather than a mathematical classification. This convention gives callers a precise distinction between a valid negative answer and an invalid request.
How the checker calculates an exact answer
JSON integers and decimal integer strings are accepted, while fractions, scientific notation, infinities, and values outside JavaScript's safe integer range are rejected. If the candidate cubed is not exactly n, is_perfect_cube is false and cube_root is omitted, since an integer cube root does not apply. If it is exact, the root is returned and compared with digit_sum. No network request, random value, stored state, or current time participates, so repeated calls with the same input produce the same JSON result in the browser and API.
Using the result in study, tests, and data pipelines
Dudeney numbers are useful examples in recreational number theory because a simple decimal operation unexpectedly agrees with exponentiation. Teachers can use the checker to demonstrate why each condition matters, asking students to predict the digit sum and cube status before revealing the structured result. Students can verify hand calculations without losing the intermediate evidence behind the classification. For bulk exploration, let your own bounded loop supply values and retain only responses whose dudeney field is true. The explicit is_perfect_cube field makes it easy to separate ordinary non-cubes from cubes whose roots merely fail the digit-sum condition. The optional cube_root appears only when mathematically applicable, which avoids ambiguous null values in typed clients. Browser execution is convenient for individual exploration, while automated successful requests cost $0.002 each and use the identical pure solver. This tool tests one supplied value per request; it does not enumerate a range or claim that every digit-based cube curiosity uses the Dudeney definition.
Integration use cases
Test sequence generators
Use deterministic responses as fixtures when a program generates or filters candidates from recreational integer sequences.
Technical questions
What happens when n is below one?
The request fails with invalid_input because this checker accepts only positive integers.
How much does the API request cost?
Each successful API request costs $0.002. You can also run the same deterministic calculation in your browser.