import time

start = time.time()

# create a quick prime sieve
N = 100000000
sieve = [True] * N
sieve[0] = False
sieve[1] = False


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


for i in range(2, int(N ** (1 / 2)) + 1):
    if sieve[i]:
        mark(sieve, i)

digits = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]

max_pan = 0
max_length = 0
for i in range(N):
    if sieve[i]:
        length = len(str(i))
        if all(digit in str(i) for digit in digits[:length]):
            max_pan = i
            max_length = length


print("Max. pandigital number is %s with length %s." % (max_pan, max_length))

6bc8caf0446ca7be372efc0ff02a5c82d24bb54b
<mask token>


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


<mask token>

<mask token>


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


for i in range(2, int(N ** (1 / 2)) + 1):
    if sieve[i]:
        mark(sieve, i)
<mask token>
for i in range(N):
    if sieve[i]:
        length = len(str(i))
        if all(digit in str(i) for digit in digits[:length]):
            max_pan = i
            max_length = length
print('Max. pandigital number is %s with length %s.' % (max_pan, max_length))

<mask token>
start = time.time()
N = 100000000
sieve = [True] * N
sieve[0] = False
sieve[1] = False


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


for i in range(2, int(N ** (1 / 2)) + 1):
    if sieve[i]:
        mark(sieve, i)
digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
max_pan = 0
max_length = 0
for i in range(N):
    if sieve[i]:
        length = len(str(i))
        if all(digit in str(i) for digit in digits[:length]):
            max_pan = i
            max_length = length
print('Max. pandigital number is %s with length %s.' % (max_pan, max_length))

import time
start = time.time()
N = 100000000
sieve = [True] * N
sieve[0] = False
sieve[1] = False


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


for i in range(2, int(N ** (1 / 2)) + 1):
    if sieve[i]:
        mark(sieve, i)
digits = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
max_pan = 0
max_length = 0
for i in range(N):
    if sieve[i]:
        length = len(str(i))
        if all(digit in str(i) for digit in digits[:length]):
            max_pan = i
            max_length = length
print('Max. pandigital number is %s with length %s.' % (max_pan, max_length))

import time

start = time.time()

# create a quick prime sieve
N = 100000000
sieve = [True] * N
sieve[0] = False
sieve[1] = False


def mark(sieve, x):
    for i in range(2 * x, N, x):
        sieve[i] = False


for i in range(2, int(N ** (1 / 2)) + 1):
    if sieve[i]:
        mark(sieve, i)

digits = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]

max_pan = 0
max_length = 0
for i in range(N):
    if sieve[i]:
        length = len(str(i))
        if all(digit in str(i) for digit in digits[:length]):
            max_pan = i
            max_length = length


print("Max. pandigital number is %s with length %s." % (max_pan, max_length))
