Related to this question,

What is the smallest prime number made of sequential number?

are there infinitely many primes of the following form (OEIS A057137)?

$1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 1234567890, 12345678901, 123456789012, 1234567890123, 12345678901234, 123456789012345, 1234567890123456, 12345678901234567, 123456789012345678, 1234567890123456789, \dots$

The first five such primes are fairly easy to find via brute force with the aid of a computer and have the following lengths:

$171, 277, 367, 561, 567$

The sixth term comes after a bit of a gap with length $18881$ (see OEIS A120819), which takes a significant amount of computation time to reach, even just testing integers ending in $1$ and $7$.

Are there infinitely many such primes?

Edit: For such numbers ending in $1$, we can write

$$x_n = 10^{10n} + 2345678901 \cdot \frac{10^{10n}-1}{10^{10}-1}$$

and for such numbers ending in $7$, we can write

$$y_n = 1234567 \cdot 10^{10n} + 8901234567\cdot \frac{10^{10n}-1}{10^{10}-1}$$

  • 2
    $\begingroup$ A possible approach towards solution: This sequence contains a sub-sequence that can be expressed using a recurrence relation of $a_1=1$ and $a_{n+1}=10000000000a_n+2345678901$. Try to convert this recurrence relation into an explicit formula, then perhaps use Dirichlet theorem (though I doubt that it will work, since the explicit formula is not going to be a polynomial I suppose). $\endgroup$ Oct 4, 2016 at 5:40
  • 5
    $\begingroup$ If the answers were known, I'd expect they'd be mentioned at the OEIS page. $\endgroup$ Oct 4, 2016 at 6:24
  • 3
    $\begingroup$ This might be hard... as @barakmanos says we can look at a recurrence $a_{n+1} = r a_n + C, a_0 = 1$ which has solution $a_{n} = r^n + Cr^{n-1} + \cdots + Cr + C$. Whether or not that solution has infinitely many primes with $C = 1, r = 2$ is the Mersenne prime conjecture. $\endgroup$ Nov 20, 2016 at 20:52
  • $\begingroup$ At first $1234567=127*9721$,$8901234567=3*3*29*1291*26417$ and $2345678901=3*3*71*419*8761$. $\endgroup$ Jan 30, 2017 at 14:58
  • 2
    $\begingroup$ @Pickle the recursion I wrote is not an arithmetic progression except for $r=1$. $\endgroup$ Apr 5, 2018 at 20:04

1 Answer 1


Not a complete answer, but gives a foundation to build on.

See Lemma 2 in Sury, B. "Extending Given Digits to make Primes or Perfect Powers". Resonance (2010). pp. 941-947. URL: https://www.ias.ac.in/article/fulltext/reso/015/10/0941-0947

Lemma 2. Let $A$ be any given natural number. Then, one may add digits to the right end of the digits of $A$ to obtain a prime number

The remaining open question to resolve the OP's question is if we could get a prime by adding a single digit.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .