This site is supported by donations to The OEIS Foundation.



Annual appeal: Please make a donation to keep the OEIS running! Over 6000 articles have referenced us, often saying "we discovered this result with the help of the OEIS".
Other ways to donate

(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004023 Indices of prime repunits: numbers n such that 11...111 = (10^n - 1)/9 is prime.
(Formerly M2114)
2, 19, 23, 317, 1031, 49081, 86453, 109297, 270343 (list; graph; refs; listen; history; text; internal format)



People who search for repunit primes or repdigit primes may be looking for this entry.

The indices of primes with digital product (i.e., product of digits) equal to 1.

As of August, 2014, only the first five repunits, through (10^1031-1)/9, have been proved prime. The last four repunits are known only to be probable primes and have not been proved to be prime. - Robert Baillie, Aug 17 2014

These indices p must also be prime. If p is not prime, say p = mn, then 10^mn - 1 = ((10^m)^n) - 1 => 10^m - 1 divides 10^mn - 1. Since 9 divides 10^m - 1 or (10^m-1)/9 = q, it follows q divides (10^p-1)/9. This is a result of the identity, a^n - b^n = (a-b)(a^(n-1) + a^(n-2)b + ... + b^(n-1). - Cino Hilliard, Dec 23 2008

The numbers R_n = 11...111 = (10^n - 1)/9 with n in this sequence A004023, except for n = 2, are prime repunits in base ten, so they are prime Brazilian numbers belonging to A085104. [See Links: Les nombres brésiliens.] - Bernard Schott, Dec 24 2012

Primality confirmed for (10^(49081)-1)/9 using sieve methods in Mathematica. - Shivam N. Patel, Dec 17 2015 [Probably it was only confirmed that this is a probable prime. - N. J. A. Sloane, Nov 10 2017]


J. Brillhart et al., Factorizations of b^n +- 1. Contemporary Mathematics, Vol. 22, Amer. Math. Soc., Providence, RI, 2nd edition, 1985; and later supplements.

J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 19, pp 6, Ellipses, Paris 2008.

Graham, Knuth and Patashnik, Concrete Mathematics, Addison-Wesley, 1994; see p 146 problem 22.

Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 60.

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).


Table of n, a(n) for n=1..9.

Paul Bourdelais, A Generalized Repunit Conjecture, NMBRTHRY, 25 Jun 2009.

John Brillhart, Letter to N. J. A. Sloane, Aug 08 1970

John Brillhart et al., Factorizations of b^n +- 1, Contemporary Mathematics, Vol. 22, Amer. Math. Soc., Providence, RI, 3rd edition, 2002.

Chris K. Caldwell, The Prime Glossary, Repunit

Patrick De Geest, Circular Primes

Giovanni Di Maria, Repunit Primes Project

Harvey Dubner, Generalized repunit primes, Math. Comp., 61 (1993), 927-930. [Annotated scanned copy]

Harvey Dubner, New probable prime repunit, R(49081), Number Theory List, Sep 09 1999.

Harvey Dubner, Repunit R49081 is a probable prime, Math. Comp., 71 (2001), 833-835.

Harvey Dubner, Posting to Number Theory List : Apr 03 2007

Martianus Frederic Ezerman, Bertrand Meyer, and Patrick Solé, On Polynomial Pairs of Integers, arXiv:1210.7593 [math.NT], 2012-2014.

Martianus Frederic Ezerman, Bertrand Meyer and Patrick Solé, On Polynomial Pairs of Integers, Journal of Integer Sequences, Vol. 18 (2015), Article 15.3.5.

Makoto Kamada, Factorizations of 11...11 (Repunit).

Henri Lifchitz, Mersenne and Fermat primes field

Bernard Schott, Les nombres brésiliens, Quadrature, no. 76, avril-juin 2010, pages 30-38; included here with permission from the editors of Quadrature.

Andy Steward, Prime Generalized Repunits

Sam Wagstaff, Jr., The Cunningham Project

E. Wegrzynowski, Nombres 1_[n] premiers

Eric Weisstein's World of Mathematics, Repunit

Eric Weisstein's World of Mathematics, Integer Sequence Primes

H. C. Williams and Harvey Dubner, The primality of R1031, Math. Comp., 47(176), Oct 1986, 703-711.

Index entries for primes involving repunits


2 appears because the 2-digit repunit 11 is prime.

3 does not appear because 111 = 3 * 37 is not prime.

19 appears because the 19-digit repunit 1111111111111111111 is prime.


Select[Range[271000], PrimeQ[FromDigits[PadRight[{}, #, 1]]] &] (* Harvey P. Dale, Nov 05 2011 *)

repUnsUpTo[k_] := ParallelMap[If[PrimeQ[#] && PrimeQ[(10^# - 1)/9], #, Nothing] &, Range[k]]; repUnsUpTo[5000] (* Mikk Heidemaa, Apr 24 2017 *)


(PARI) forprime(x=2, 20000, if(ispseudoprime((10^x-1)/9), print1(x", "))) \\ Cino Hilliard, Dec 23 2008

(MAGMA) [p: p in PrimesUpTo(500) | IsPrime((10^p - 1) div 9)]; // Vincenzo Librandi, Nov 06 2014


See A004022 for the actual primes.

Cf. A055557, A002275, A085104.

Sequence in context: A105907 A018696 A175451 * A186682 A031030 A083689

Adjacent sequences:  A004020 A004021 A004022 * A004024 A004025 A004026




N. J. A. Sloane


49081 found by Harvey Dubner - posting to Number Theory List (NMBRTHRY(AT)LISTSERV.NODAK.EDU) Sep 09, 1999.

86453 found using pfgw (a faster version of PrimeForm) on Oct 26 2000 by Lew Baxter (ldenverb(AT)hotmail.com) - posting to Number Theory List (NMBRTHRY(AT)LISTSERV.NODAK.EDU), Oct 26, 2000.

a(8) = 109297 was apparently discovered independently by (in alphabetical order) Paul Bourdelais and Harvey Dubner (harvey(AT)dubner.com) around Mar 26-28 2007.

A new probable prime repunit, R(270343), was found Jul 11 2007 by Maksym Voznyy (mvoznyy0526(AT)ROGERS.COM) and Anton Budnyy.

R(270343) subsequently confirmed as a(9) (see Repunit Primes Project link) by Robert Price, Dec 14 2010

Link to Repunit Primes Project site updated by Felix Fröhlich, Oct 19 2014



Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified December 17 03:10 EST 2017. Contains 296096 sequences.