Skip to content

Instantly share code, notes, and snippets.

@Lucas-Developer
Created April 29, 2018 19:32
Show Gist options
  • Select an option

  • Save Lucas-Developer/b07010861e18c74e12259f8407a00b1b to your computer and use it in GitHub Desktop.

Select an option

Save Lucas-Developer/b07010861e18c74e12259f8407a00b1b to your computer and use it in GitHub Desktop.

Revisions

  1. Lucas-Developer created this gist Apr 29, 2018.
    8 changes: 8 additions & 0 deletions crivo_de_eratóstenes.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    def eratosthenes2(n):
    multiples = set()
    for i in range(2, n+1):
    if i not in multiples:
    yield i
    multiples.update(range(i*i, n+1, i))

    print(list(eratosthenes2(100)))