Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'Cyph3r'
- import math
- f = str(input("Filename?"))
- text_file = open(f+".txt", "w")
- n = int(input("Limit? ")) # Limit Number
- x = int(input("Start? ")) # Starting Number
- a = int(math.sqrt(x))+1 # Working number
- while x != n:
- if x % a != 0: # Not equal divide
- if a != 1: # Check if (a) not at bottom of list
- a -= 1
- if a == 1: # Check if (a) is at bottom of list
- text_file.write(str(x)+"\n")
- print(str(x)+" is Prime!")
- x += 1
- if x % a == 0: # If Equal divide, skip
- x += 1
- a = int(math.sqrt(x))+1
- text_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement