Created
June 6, 2013 22:43
-
-
Save maurostorch/5725596 to your computer and use it in GitHub Desktop.
My Windows Azure workload in Python! http://maurostorch.cloudapp.net/prime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from time import gmtime, strftime | |
from math import sqrt | |
def isprimo(p): | |
i=long(sqrt(p)) | |
while True: | |
if p%i==0: return False | |
if i<=2: break | |
i = i - 1 | |
return True | |
def main(): | |
start = long(sys.argv[1]) | |
stime= 'Starting from '+str(start)+' '+strftime("at %a, %d %b %Y %H:%M:%S +0000\n", gmtime()) | |
while True: | |
if isprimo(start): | |
f = open('last','w') | |
f.write(stime) | |
f.write(str(start)+' at +'+strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())+'\n') | |
f.close() | |
start = start + 1 | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment