# smallest prime number made of consecutive numbers as its digits in decimal representation

i have been curious about prime numbers lately and have been wondering what is the smallest prime number that is made of consecutive numbers as its digits.

example of number for further clarification: 1234567891011121314151617.........

i have checked till sequence till '16' number by bruteforce. currently facing problem for '17' numbers sequence. i just wanted to know if there exits a number in such above pattern that is actually a prime?? is it ever calculated by someone before. or is there any property/theorem that describes such numbers cannot be prime.

more clarification regd sequence

1
12
123
1234
.
.
123456789
12345678910
1234567891011 . .

Edit: I have written a python script with gmpy2 library to check for primes (based on answer). i have checked till 2000 but the program cannot find any. not sure if the program is working or not for very large numbers.

#code to print primes
import gmpy2

digit = 1
number = 1
count=2000
while count:
# print(count)
if gmpy2.is_prime(number):
print(number)
print("isprime")
break
count=count-1
digit=digit+1
temp=digit
while temp!= 0:
temp //= 10
number=number*10
number=number+digit


• You have taken into account my remarks that I erase now that your text is well improved. Sep 11, 2021 at 21:37
• mathworld.wolfram.com/SmarandachePrime.html Sep 11, 2021 at 23:37
• @nickgard Good catch ! Sep 12, 2021 at 10:10

Let $$N(n)$$ be some positive integer whose digits are the consecutive positive integers up to $$n$$.

Claim

$$N(n)$$ is composite for $$n\neq 6k+1$$ $$k\in \mathbb N$$

Proof

$$N(2k)$$ is divisible by $$2$$ because its last digit is even.

For $$N(3k)$$ is easy to verify that the sum of its digits is divisible by $$3$$, which implies that $$N(3k)$$ is divisible by $$3$$ (divisibility criteria). This in turn implies that the sum of digits of $$N(3k-1)$$ is also divisible by $$3$$ (otherwise, adding as digits the number $$3k$$ would result in a number $$N(3k)$$ not divisible by $$3$$).

Therefore, $$N(n)$$ is composite for $$n\neq 6k+1$$ $$k\in \mathbb N$$

• Could you explain more completely why $N(3k-1)$ has to be divisible by $3$ ? Sep 14, 2021 at 5:29
• $N(3k-1)$ is equal to $N(3k)$, whose sum of digits is divisible by $3$, less the digits of $3k$, whose sum of digits is divisible by $3$; thus, it follows that the sum of digits of $N(3k-1)$ is divisible by $3$, and thus $N(3k-1)$ is divisible by $3$. Sep 14, 2021 at 10:18
• That's clear, Juan-- Thanks and +1. Sep 14, 2021 at 10:23
• You are welcome! ;-) Sep 14, 2021 at 19:24

Unfortunately, no prime of the form $$1\_2\_...\_n$$ has been found yet. Furthermore, it has been conjectured that such a prime could not exist at all, since every candidate up to $$1\_2\_...\_1000000$$ has been already checked (Batalov, 2018). For details, see https://mathworld.wolfram.com/SmarandachePrime.html and also the YouTube video https://www.youtube.com/watch?v=vKlVNFOHJ9I.

Moreover, also truncated concatenations, known as Champernown primes, have already been checked up to very large terms and the smallest $$7$$ such primes are listed in the OEIS sequence $$A176942$$ (see https://oeis.org/A176942), while the eighth one should be above $$1\_2\_...\_113821$$ according to https://oeis.org/A071620