Repunit Calculator

Print the repunit with n copies of the digit one, equal to ten to the n minus one over nine.

Math and PercentUpdated 2026-11-182 min read
Repunit Calculator
A whole number from 0 to 1,000.
Repunit R(n)
...
Number of digits...
Previous repunit...

What it does

A repunit is a number whose decimal digits are all one. The sequence starts 0, 1, 11, 111, 1111 and so on. The name is a contraction of repeated unit, and the nth value is written R(n).

The closed form is ten to the power n minus one, divided by nine. That identity is the geometric series one plus ten plus ten squared and so on, which explains why the digits are all one.

Repunits are studied because their factorizations have special structure. A repunit can only be prime if its index n is prime, though that condition is not sufficient. Large repunit primes are a active area of computational number theory.

This page prints the full decimal string of R(n) rather than a floating point value, so the result is exact even for a thousand digits. It also shows the previous repunit for comparison.

The index limit is one thousand. The output at that size is a thousand character string, which the browser can display without difficulty.

How to use

  1. Enter the number of ones n from 0 to 1,000.
  2. Read R(n) in the main result box.
  3. Check the digit count beside it.
  4. The previous repunit is shown for comparison.
  5. The default n = 5 reproduces the worked example.
  6. Try n = 0 to see the conventional value zero.

Formula

R(n) = (10^n - 1) / 9 = 111...1 with n ones, and R(0) = 0
n
The number of ones in the repunit.
R(n)
The repunit with n ones.
10^n
The power of ten used in the closed form.

The value at n = 0 is zero by the convention used in the standard sequence, even though the closed form gives zero as well. Every repunit with at least one digit is odd, since its final digit is one.

Worked example

Example: five ones

The page opens with n = 5.

  1. Write the closed form: R(5) = (10^5 - 1) / 9.
  2. Compute ten to the fifth: 100000.
  3. Subtract one: 99999.
  4. Divide by nine: 11111.
  5. The tool reports 11111, five digits, and previous repunit 1111.
  6. The digit string matches the direct construction of five ones.

Reference table

Repunits at small indices
nR(n)DigitsPrevious
001n/a
1110
21121
3111311
51111151111
10111111111110111111111

Limits

  • Indices above 1,000 are rejected to keep the displayed string manageable.
  • The tool prints the value, it does not factor it.
  • The output is a decimal string, not a floating point approximation.
  • Only base ten repunits are covered.

Common mistakes

  • Using ten to the n minus one directly instead of dividing by nine.
  • Taking R(0) to be one instead of zero.
  • Assuming every repunit with prime index is prime.
  • Using a floating point power and losing digits.
  • Confusing repunits with repdigits of other digits.

Try it yourself

Quick checks. Answers sit tucked under each question.

What is R(5)?

11111, from (100000 - 1) / 9.

What is R(3)?

111.

What is R(0)?

Zero by convention.

Questions

Why is (10^n - 1)/9 a string of ones?

It is the sum of the geometric series one plus ten plus ten squared up to ten to the n minus one.

Can a repunit be prime?

Yes, but its index must be prime, and that condition alone is not enough.

What is R(0)?

Zero in the standard convention used here.

Are all repunits odd?

Yes, because they end in the digit one.

Are the values exact?

Yes, they are printed as decimal strings.

What index range is accepted?

Zero through 1,000.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.