Celeb Glow
general | April 20, 2026

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

$\begingroup$

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
$\endgroup$ 3

1 Answer

$\begingroup$

Partial answer

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$

$\endgroup$ 4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy