Skip to content

Instantly share code, notes, and snippets.

@aashish-chaubey
Created August 6, 2022 07:18
Show Gist options
  • Select an option

  • Save aashish-chaubey/802464cdebffffb40aa56d53b9077d97 to your computer and use it in GitHub Desktop.

Select an option

Save aashish-chaubey/802464cdebffffb40aa56d53b9077d97 to your computer and use it in GitHub Desktop.

Revisions

  1. aashish-chaubey created this gist Aug 6, 2022.
    13 changes: 13 additions & 0 deletions prime_numbers.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    import math

    l = 50

    def is_prime(num: int) -> bool:
    lim = math.floor(math.sqrt(num))
    for i in range(2, lim+1):
    if num % i == 0:
    return False
    return True

    prime_numbers = filter(is_prime, list(range(2, l+1)))
    print(list(prime_numbers))