Repunit checker
Checks whether a positive whole number is written only with the digit 1: 111 is the three-digit repunit, equal to (10^3 − 1)/9. You also get the list of digits, so you can see exactly why a number passes or fails. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 111
- Digit count
- 3
- Digits
- 1, 1, 1
A repunit is a positive integer written entirely with the digit one in base ten—one, eleven, one hundred eleven, one thousand one hundred eleven, and so on. In closed form the k-digit repunit is R_k equals (ten to the k minus one) divided by nine. Repunits appear in recreational number theory, coding exercises about digit patterns, and the study of which R_k are prime. This capability takes a single positive integer n, extracts its decimal digits with pure integer arithmetic, and reports whether every digit is one together with the digit list and a compact formula string so students and scripts can audit the decision. Values below one are rejected as invalid input and are never charged.
What a repunit is and how to recognize one
Write a positive integer in decimal and look at every digit from left to right. If each digit is exactly one and there are no zeros, twos, or any other symbols, the number is a repunit. The one-digit case is simply one.
Two digits give eleven; three digits give one hundred eleven; four digits give one thousand one hundred eleven. Algebraically the k-digit repunit equals (ten to the power k minus one) divided by nine, often written R_k. That formula is the same idea as the repeating ones you get when you subtract one from a power of ten and divide by nine: nine hundred ninety-nine divided by nine is one hundred eleven, for example.
Numbers such as twelve, one hundred one, or one thousand one fail because at least one digit is not one. Negative values and zero are outside the positive-integer definition used here and must be rejected rather than labeled false. The property is fully deterministic: there is no sampling, no approximate floating-point path, and no dependence on clocks or remote services.
Classroom materials often contrast repunits with related digit curiosities such as repdigits (a single repeated digit other than one), palindromes, or Armstrong numbers; those are different search intents and different checks.
What you can do with it
Programming contest and interview prep validators
Assert candidate solutions for classic repunit or all-ones digit problems without reimplementing digit extraction in every language harness.
FAQ
What is a repunit?
A positive integer whose every decimal digit is one, such as 1, 11, 111, or 1111. Equivalently R_k = (10^k − 1) / 9 for digit count k.
Does this test whether a repunit is prime?
No. It only checks that all digits are ones. Primality of R_k is a different problem and is out of scope.
Is the repunit checker free?
The browser tool is free and runs locally.
Why is 12 not a repunit?
Because one of its digits is 2. A repunit may contain only ones, so any other digit, including a zero, makes the check fail and the digit list shows which one.
What is the formula for a repunit?
The repunit with k digits equals (10^k − 1)/9. For three digits, 999 divided by 9 gives 111, the same pattern of ones you get from any power of ten minus one.
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/repunit-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":111}'const res = await fetch("https://api.kit.forhosting.com/numth/repunit-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 111
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/repunit-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 111
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/repunit-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":111}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":111}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/repunit-check", 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": 111
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.repunit_check",
"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
What a repunit is and how to recognize one
Because digit extraction and comparison are elementary, learners can recompute the boolean by hand for small examples and match the API field by field.
How to call the checker and read the response
Use it from homework pipelines, programming-contest validators, interview-prep sandboxes, recreational-math pages, or any workflow that needs a reproducible all-ones digit check without installing a computer-algebra system on every machine. Send a JSON body with a required field n holding a positive whole number, either as a JSON number inside the safe integer range or as a plain digit string that normalizes to an integer. Aliases number and value are accepted for the same field. On success the response includes n as accepted, digit_count, digits as an ordered array from most to least significant, is_repunit as a boolean, and formula as a short string: when the check passes it names R_k with the closed form (ten to the k minus one) over nine; when it fails it states that the value is not a repunit. Validation failures—missing n, a non-integer, a fraction, a value above the published maximum, or any integer below one—return invalid_input and are not charged. Pricing is a flat $0.002 per successful request under the item unit with no extra marginal unit price.
Practical tips, limits, pricing, and related intents
If you need multiprecision candidates with dozens of ones, use a dedicated big-integer stack—this lightweight parse capability is built for interactive checks and teaching-sized inputs. Sibling number-theory landings in this kit cover other digit properties such as Armstrong or happy numbers; this page is specifically for people searching whether a given integer is a repunit or all ones. Keep n within the published safe-integer maximum so digit extraction stays exact on the Worker and in the browser. When teaching, show both outcomes: one and one hundred eleven as true cases, twelve or one hundred one as false cases, and zero or a negative as the hard rejection path that returns invalid_input. Pair is_repunit with digits and digit_count when grading so students who miscount length or drop a digit are easy to diagnose. Do not confuse this boolean with repunit primality tests: deciding whether R_k itself is prime is a separate, harder problem and is out of scope here. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when users type bad values while learning the contract. Delivery works from the web form, the task API, SDK clients, and other KIT channels without changing the mathematical definition.
Integration use cases
Homework: verify repunit and all-ones answers
Give students an integer and check their hand-labeled yes/no and digit list against a deterministic API or free browser result.
Teaching demos of decimal digit patterns
Project digits and formula in class so learners see the all-ones pattern, the R_k closed form, and the boolean side by side.
Technical questions
Is 1 considered a repunit?
Yes. The one-digit number 1 is R_1 and is_repunit is true.
What about 0 or negative numbers?
Values below 1 are rejected with invalid_input. This checker only accepts positive integers.