Skip to content

Instantly share code, notes, and snippets.

@oschettler
Created June 4, 2019 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oschettler/13c70d424276357fcac488119d28c2c8 to your computer and use it in GitHub Desktop.
Save oschettler/13c70d424276357fcac488119d28c2c8 to your computer and use it in GitHub Desktop.
Primzahlen nach dem Sieb des Eratosthenes für die vierte Klasse
# Arbeitsheft 4
# Seite 86
primzahlen = [2]
zahlen = list(range(2, 101))
def streiche(vielfaches_von):
return [zahl
for zahl in zahlen
if zahl % vielfaches_von != 0]
primzahl = 2
while len(zahlen) > 0:
zahlen = streiche(primzahl)
primzahl = zahlen.pop(0)
primzahlen.append(primzahl);
# print(primzahl, zahlen)
print("PRIMZAHLEN:", primzahlen);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment