Skip to content

Instantly share code, notes, and snippets.

@Pavel-Durov
Created September 24, 2022 14:08
Show Gist options
  • Save Pavel-Durov/d0d6437236b6541b91801ac0f2f17c4e to your computer and use it in GitHub Desktop.
Save Pavel-Durov/d0d6437236b6541b91801ac0f2f17c4e to your computer and use it in GitHub Desktop.
import os
import sys
def prime(n):
primes = []
for num in range(0, n):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
primes.append(num)
return primes
def write(s):
os.write(1, bytes(s))
def entry_point(argv):
num = int(argv[1])
primes = prime(num)
write('calculated primes: \n')
for p in primes:
write(str(p) + ' ')
return 0
def target(*args):
"""
"target" returns the entry point.
The translation process imports your module and looks for that name,
calls it, and the function object returned is where it starts the translation.
"""
return entry_point, None
if __name__ == '__main__':
entry_point(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment