Advertisement
superpawko

Untitled

Oct 6th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def genPrimes():
  2. n = 2 # START NUMBER
  3. t = {} # dictoniary what was one
  4. p = [] # primes list
  5. while n != 24: # END number for now
  6. t[n] = []
  7. for x in range(2,(n//2)+2): # search for number which is not more than half of a "n"
  8. t[n].extend([x])
  9. if n % x ==0:
  10. break
  11. if x == (n//2)+1: # after checking every number and it is still working append prime number
  12. p.append(n)
  13.  
  14. n += 1
  15. print(t)
  16. print(p)
  17.  
  18. print(genPrimes())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement