ForHosting KIT · Math

Permutable Prime Checker

Check whether a prime stays prime however you rearrange its digits: 113 passes, since all 3 distinct orderings of its digits are prime. When a number fails, you see the first composite arrangement. Works up to ten digits. 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
113
You get
Permutations tested
3

A permutable prime remains prime no matter how its decimal digits are rearranged. This checker accepts an integer, generates each distinct digit permutation, and tests every resulting value with deterministic integer arithmetic. It reports whether the original number satisfies the property, how many arrangements were tested, and the first composite arrangement when the test fails. Repeated digits are handled without checking duplicate arrangements, while any arrangement beginning with zero is interpreted as the ordinary integer represented by those digits.

What the permutable-prime test means

A number is accepted only when every distinct ordering of all its decimal digits represents a prime number. This condition is stronger than merely asking whether the original number is prime, and it is also different from a circular-prime test, which examines only rotations. For example, digits may move to any position, not just from one end to the other.

The checker keeps repeated digits, but it avoids evaluating the same arrangement more than once when swapping identical copies would produce no visible change. If an arrangement starts with zero, its numeric value is tested normally after that leading zero ceases to affect the value. A successful response also states the number of distinct arrangements examined.

How to enter a number and read the result

Provide n as unsigned base-ten text with no commas, spaces, decimal point, exponent, or plus sign. Text input preserves the submitted digits exactly and avoids the rounding that programming languages can introduce for large numeric values. The accepted range starts at two, because values below two are neither prime nor meaningful candidates for this capability.

Input is limited to ten digits so the exhaustive permutation requirement has a clear computational ceiling. When it is false, checking stops as soon as a composite arrangement is found, so that count describes actual work rather than the theoretical total.

Deterministic checking and practical limits

The algorithm is entirely local and deterministic: it makes no network calls, uses no random witnesses, and reads no clock. It builds unique arrangements from digit counts in sorted order, which guarantees the same traversal and the same counterexample for every identical request. Each completed arrangement is converted to an exact integer and checked for primality with small-prime division followed by fixed-base Miller–Rabin testing.

The ten-digit limit lies safely inside the range covered by those fixed witnesses, so the answer is deterministic rather than probabilistic for every accepted input. Many failures are discovered almost immediately; a rearrangement ending in an even digit or five, for instance, is composite unless it is the single-digit prime itself. Harder candidates may require checking every unique arrangement, which is precisely what the property demands.

Verify a number-theory exercise

Confirm a proposed permutable prime and obtain a concrete counterexample when any digit arrangement is composite.

Filter generated candidates

Apply an exact all-permutations predicate to decimal candidates produced by a bounded mathematical search.

Demonstrate permutation properties

Compare full digit permutation testing with ordinary primality or circular-prime rotation tests in teaching material.

Are repeated permutations tested more than once?

No. Repeated equal digits are counted during generation, so each visibly distinct arrangement is tested once.

How are leading zeros handled?

The arrangement remains visible as text, while its primality is tested using the ordinary integer value represented by those digits.

Is this the same as a circular prime?

No. Circular primes require digit rotations to be prime; this checker requires every possible digit permutation to be prime.

Is the primality result probabilistic?

No. Accepted inputs are within a range where the fixed witness set used by the implementation gives a deterministic result.

Is 113 a permutable prime?

Yes. Its digits can be arranged in 3 distinct ways, and every one of them is a prime number. The result reports those 3 arrangements as tested.

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

max_digits10
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.

What the permutable-prime test means

The response includes is_permutable_prime as the main result. A failed response identifies the first composite arrangement encountered in stable lexicographic order, making the decision easy to inspect and reproduce rather than returning an unexplained boolean.

How to enter a number and read the result

When the result is true, permutations_tested is the full number of distinct digit arrangements. The first_composite_permutation field shows the arrangement that disproved the property. It remains a string so leading zeros, when present, are visible even though primality is evaluated on the corresponding integer value.

What happens when n is below two?

The request returns an invalid_input error because the supported domain begins at two.

What does the API request cost?

Each API request costs $0.002. The browser runner is available for local interactive checks.

Read the full KIT documentation →