pra-utripalka/prastevila-vsota.py

27 lines
501 B
Python
Executable File

#!/usr/bin/python3
from functools import reduce
prastevila = []
def jePrastevilo(st):
polovica = st / 2
for p in prastevila:
if (p > polovica):
prastevila.append(st)
return True
if (st % p) == 0:
return False
prastevila.append(st)
return True
for i in range(2, 65535):
if (len(prastevila) == 128):
break
print("Prastevilo ?", i, jePrastevilo(i))
print("Vsota: ")
print(reduce(lambda x, y: x+y, prastevila, 0))