Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Created on Mon Mar 27 18:30:01 2017
- @author: Shourya Pratap Singh
- """
- import math as mt
- def prime(c):
- p = [2,]
- x = 3
- if c>1:
- while x<=c:
- check = 0
- if x==49:
- x = x + 2
- if len(p)**0.5 > 4*mt.exp(1)**(mt.log10(c)-1):
- z = 4*mt.exp(1)**(mt.log10(c)-1)
- else:
- z = len(p)**0.5
- for i in range (2,int(z)+1):
- if x%p[i] == 0:
- check = 1
- break
- if check==0:
- p.append(x)
- x = x + 2
- print p
- #prints prime numbers till the integer that is passed to the function 'prime'
- p = prime(100000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement