No entendi muy bien lo de la salida, de todo modos:
Código Python:
Ver originaldef is_prime(n):
return all(n % i for i in range(2, n))
prime_numbers = []
count = 0
current_number = 1
while count <= 1000:
if is_prime(current_number):
prime_numbers.append(current_number)
count += 1
current_number += 1
allowed_range = range(1, 1001)
index = 0
while index not in allowed_range:
try:
index = int(raw_input())
except ValueError:
continue
print prime_numbers[index]