Created
December 2, 2020 20:54
-
-
Save wolfgang42/2df001b05065488620700f0fdfa58a08 to your computer and use it in GitHub Desktop.
Interesting lottery numbers
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 | |
def sequences(): | |
for line in sys.stdin: | |
if line.startswith('#'): continue | |
if not line.startswith('A'): raise Exception("unexpected line: "+line) | |
[_, seq] = line.strip().split(' ') | |
seq = [int(n) for n in seq.split(',') if n != ''] | |
yield seq | |
def group6(seq): | |
for n in range(len(seq)-5): | |
yield seq[n:n+6] | |
def match(group): | |
for i in range(5): | |
if 1 > group[i] or group[i] > 50: return False | |
if 1 > group[5] or group[5] > 25: return False | |
return True | |
for seq in sequences(): | |
if len(seq) < 6: continue | |
for group in group6(seq): | |
if match(group): | |
print(group) |
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
zcat oeis-stripped.gz | python3 ./oeis-commons.py | sort -u | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment