fork download
  1. import math
  2. def primeList(listLength):
  3. plist = [2, 3]
  4. j = 3
  5. while listLength > len(plist):
  6. prime = 'true'
  7. i = 0
  8. j +=2
  9. plist.append(j)
  10. while plist[i] <= math.sqrt(j) and prime == 'true':
  11. if j%plist[i] == 0:
  12. prime = 'false'
  13. i +=1
  14. if prime == 'false':
  15. plist.pop(-1)
  16. return plist
  17.  
  18. primeList(10000)
Success #stdin #stdout 0.49s 8832KB
stdin
Standard input is empty
stdout
Standard output is empty