Created
May 18, 2015 12:33
-
-
Save sbp/b5894d6abab2d1634cc7 to your computer and use it in GitHub Desktop.
6 aus 49 generator
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
#!/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