import math
def is_prime(a):
for i in range(2, int(math.sqrt(a)) + 1):
if a % i == 0:
return i
return True
def prime_ant(turns):
p = 0
A = []
for i in range(turns):
A.append(i + 2)
for n in range(turns):
q = is_prime(A[p])
if q == True:
p += 1
else:
A[p] = A[p] // q
A[p - 1] = A[p - 1] + q
p -= 1
return A[: p + 1]
To embed this program on your website, copy the following code and paste it into your website's HTML: