Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. def eratosthenes():
  2.     count = 1
  3.  
  4.     while True:
  5.         count += 1
  6.         mod_of_two = (count % 2 == 0)
  7.         mod_of_three = count % 3 == 0
  8.         mod_of_five = count % 5 == 0
  9.         mod_of_seven = count % 7 == 0
  10.  
  11.         if (mod_of_two and (count != 2) or (mod_of_three and count != 3) or (mod_of_five and count != 5) or (mod_of_seven and count != 7)):
  12.             pass
  13.         else:
  14.             print(count)
  15.             yield count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement