- #1

Kekkuli

- 9

- 2

Big Prime number:

```
import math
maxind = 1500000000 # let's calculate prime numbers smaller than 1.5 billion
primesarray = [True] * (maxind + 1)
amount = maxind
number = 0
ind = 0
squareroot = 0.0
candinate = 0
helper = 0def is_prime_number(num):
if num % 2 == 0:
return False
else:
index = 3
itis = True
while index <= math.isqrt(num) and itis:
if primesarray[index]:
if num % index == 0:
itis = False
print(index)
index += 2
return itisamount = maxind
squareroot = math.isqrt(amount)
for ind in range(2, maxind + 1):
primesarray[ind] = True # let's suppose all are primes
primesarray[1] = False
number = 2
ind = number
while ind <= amount:
primesarray[ind] = False # remove 2's multiplies
ind += 2
while number < squareroot:
while primesarray[number] is False and number < squareroot:
number += 1 # let's find next prime number
ind = number + number
while ind < amount: # remove its multiplies
primesarray[ind] = False
ind += number
number += 1
primesarray[2] = True
# Prime numbers smaller than a billion have now been tabulated.
# Let's print a hundred smaller ones as a test.
for ind in range(1, 101):
if primesarray[ind]:
print(ind)
# let's examine candidate number
helper = 1
while helper < 20:
candinate = maxind * maxind - helper
if is_prime_number(candinate):
print(candinate, ' is a prime number.')
else:
print(candinate, ' is not a prime number.')
helper += 2
```