Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def genPrimes():
- n = 2 # START NUMBER
- t = {} # dictoniary what was one
- p = [] # primes list
- while n != 24: # END number for now
- t[n] = []
- for x in range(2,(n//2)+2): # search for number which is not more than half of a "n"
- t[n].extend([x])
- if n % x ==0:
- break
- if x == (n//2)+1: # after checking every number and it is still working append prime number
- p.append(n)
- n += 1
- print(t)
- print(p)
- print(genPrimes())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement