Files
tinyproject-monorepo/prg/SJNet_primzalen_calc.py
2026-10-22 19:10:14 +02:00

34 lines
625 B
Python

#import time
print("Prime number calc")
checked = []
primes=[]
now=1
def is_ganz(zahl):
try:
return float(int(zahl)) == zahl
except ValueError:
return False
def is_teilbar(nummer, teiler):
geteilt=nummer/teiler
return is_ganz(geteilt)
while True:
now += 1
#if is_teilbar(now, 50):
# print("[debug]: das ist cheecked:"+str(checked))
if not now in checked:
x=0
for i in checked:
if is_teilbar(now, i):
x += 1
if x==0:
primes.append(now)
print(now)
checked.append(now)
#time.sleep(0.01)