ForHosting KIT · Math

Additive prime checker

23 is an additive prime: it is prime, and its digits add up to 5, which is prime too. Enter a whole number from 2 and see both checks side by side, so you know which half fails when one does. 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
23
You get
Digits
2, 3
Digit sum
5

An additive prime is a prime number whose decimal digits also sum to a prime. Classic examples include 2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, and 101: each is prime, and the sum of its digits is a small prime such as 2, 5, 7, 11, or 17. Numbers such as 19 and 13 are prime but fail the second test because 1+9=10 and 1+3=4 are composite.

What an additive prime is and how the double test works

In recreational number theory an additive prime (sometimes called a prime with a prime digit sum) is defined by two independent primality conditions that must both hold. First, n itself must be a prime number: an integer greater than or equal to two whose only positive divisors are one and itself. Second, if you add the decimal digits of n, that sum must also be prime.

The digit sum is always a small non-negative integer relative to n—for any safe JavaScript integer it stays well below a few hundred—so the second primality check is cheap once the digits are known. Single-digit primes 2, 3, 5, and 7 are automatically additive primes because the digit sum equals the number. Two-digit examples include 11 (1+1=2), 23 (2+3=5), and 29 (2+9=11).

Where an additive prime checker fits real workflows

Teachers and contest coaches use an additive prime checker to verify homework lists, generate counter-examples that are prime but not additive, and show the digit-sum step beside the final flag. Puzzle and game designers filter candidate seeds so only additive primes enter a level table, which is a stricter gate than a plain is-prime check and produces a distinctive sequence students notice.

Prefer this capability when the search intent or product rule is specifically the double condition—not when you only need ordinary primality (use a plain is-prime checker), not when you need full factorization, and not when you only need the digit sum without primality of either value.

Homework and contest verification

Check student lists of additive primes and show which half of the definition failed when a number is prime but its digit sum is composite.

Puzzle seed and level filters

Accept only additive primes as seeds or level IDs so the sequence is stricter and more distinctive than plain primes alone.

What is an additive prime?

A prime number whose decimal digits sum to a prime. Both n and the digit sum must be prime; failing either condition means n is not additive.

Which inputs are accepted?

Whole integers n ≥ 2 up to the safe-integer maximum.

Why is 19 not an additive prime?

Because only half of the definition holds. 19 is prime, but its digits add up to 10, which is not. Both the number and its digit sum must be prime.

Which numbers are additive primes?

Examples are 2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89 and 101. Each is prime, and its digit sum, such as 2, 5, 7, 11 or 17, is prime too.

Does the result show which condition failed?

Yes. Besides the final answer, you see whether the number itself is prime, its digits, their sum and whether that sum is prime, so a rejection always comes with its reason.

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/additive-prime

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

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.

This additive prime checker accepts a single integer n greater than or equal to two, reports whether n is prime, lists the digits and their sum, says whether that sum is prime, and returns a clear is_additive_prime flag. The same pure arithmetic runs free in the browser and on the API, so homework checks and automation never disagree on a borderline case.

What an additive prime is and how the double test works

Counter-examples help fix the definition: 19 is prime yet 1+9=10 is even and greater than two, so 19 is not additive; 4 is composite, so it fails regardless of digits; 1 is neither prime nor accepted by this API. The endpoint always returns both intermediate flags (is_prime and digit_sum_is_prime) plus the digits array and digit_sum, so you can teach or log exactly which half of the definition failed when is_additive_prime is false. That transparency is more useful than a bare yes-or-no for classrooms, puzzle generators, and data audits that need an explanatory trail rather than a silent rejection.

Input contract, response fields, and error behaviour

The upper bound is the JavaScript safe-integer maximum so every result stays exact in ordinary Number arithmetic. Example: n equals 1 or n equals 0 fails with a message that n must be greater than or equal to two. Send a JSON body with one required field n: a whole integer greater than or equal to two, accepted as a JSON number or as a decimal digit string with an optional leading plus sign. Fractions, booleans, empty strings, scientific notation, leading zeros on multi-digit strings, and values below two are rejected with invalid_input before any primality work runs. On success the response echoes n, sets is_prime after deterministic trial division with a six-step wheel, lists digits most-significant-first, reports digit_sum as the plain sum of those digits, sets digit_sum_is_prime with the same primality routine, and finally sets is_additive_prime to the logical and of the two prime flags. Example: n equals 23 yields digits [2, 3], digit_sum 5, both primality flags true, and is_additive_prime true. Example: n equals 19 yields is_prime true, digit_sum 10, digit_sum_is_prime false, and is_additive_prime false. Invalid requests are not billed; successful calls use the published $0.002 base price on the API path.

Where an additive prime checker fits real workflows

Data engineers sometimes tag identifier columns that are supposed to follow recreational-number constraints; running this endpoint over a batch catches rows that are prime-shaped yet fail the digit-sum condition, and the returned digit_sum explains why. Keep n an integer of at least two, treat invalid_input as a client fix rather than a retry, store the intermediate flags if you need audit detail, and you get reproducible additive-prime decisions for LMS plugins, notebooks, and edge workers without standing up a computer-algebra system.

Audit recreational-number columns

Scan imported identifiers claimed to be additive primes; flag failures and attach digit_sum and both prime flags to the audit log.

What does the response include?

n, is_prime, digits, digit_sum, digit_sum_is_prime, and is_additive_prime (true only when both primality flags are true).

Is 19 an additive prime?

No. 19 is prime, but 1+9=10 is composite, so is_additive_prime is false while is_prime remains true.

What does the additive prime checker cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →