Skip to content

Instantly share code, notes, and snippets.

@maurostorch
Created June 6, 2013 22:43
Show Gist options
  • Save maurostorch/5725596 to your computer and use it in GitHub Desktop.
Save maurostorch/5725596 to your computer and use it in GitHub Desktop.
My Windows Azure workload in Python! http://maurostorch.cloudapp.net/prime
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