gateway/test-chat/extraction/method_ai_20251004-142510/raw_result.txt
2025-10-04 18:44:42 +02:00

12 lines
No EOL
980 B
Text

```json
{
"documents": [
{
"data": "def sieve_of_eratosthenes(limit):\n primes = []\n is_prime = [True] * (limit + 1)\n p = 2\n while p * p <= limit:\n if is_prime[p]:\n for i in range(p * p, limit + 1, p):\n is_prime[i] = False\n p += 1\n for p in range(2, limit + 1):\n if is_prime[p]:\n primes.append(p)\n return primes\n\n# Estimate an upper bound for the 1000th prime number\n# Using the approximation n * log(n) + n * log(log(n)) for the nth prime\nimport math\nn = 1000\nupper_bound = int(n * math.log(n) + n * math.log(math.log(n)))\n\n# Calculate the first 1000 prime numbers\nfirst_1000_primes = sieve_of_eratosthenes(upper_bound)[:1000]\n\n# Print the first 1000 prime numbers\nprint(first_1000_primes)",
"mimeType": "text/plain",
"comment": "Python code implementing the Sieve of Eratosthenes to find the first 1000 prime numbers."
}
],
"continue": false
}
```