Skip to content

Instantly share code, notes, and snippets.

@sbp
Created May 18, 2015 12:33
Show Gist options
  • Save sbp/b5894d6abab2d1634cc7 to your computer and use it in GitHub Desktop.
Save sbp/b5894d6abab2d1634cc7 to your computer and use it in GitHub Desktop.
6 aus 49 generator
#!/usr/bin/env python3
def primegen(n=2):
primes = set()
while True:
for p in primes:
if (n % p) == 0:
break
else:
primes.add(n)
yield n
n += 1
primes = primegen()
for _ in range(1337):
next(primes)
numbers = list(range(1, 50))
for c in "Swhack":
index = (ord(c) * next(primes)) % len(numbers)
print(numbers[index])
del numbers[index]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment