omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / van-eck-sequence / oracle.py
| 1 | # Independent reference for "Van Eck sequence" (Python 3, standard library only). |
| 2 | # expected.txt is this program's stdout; omc never produced it. |
| 3 | a = [0] |
| 4 | for n in range(999): |
| 5 | prev = [m for m in range(n) if a[m] == a[n]] |
| 6 | a.append(n - prev[-1] if prev else 0) |
| 7 | print("terms 1 to 10: " + " ".join(map(str, a[:10]))) |
| 8 | print("terms 991 to 1000: " + " ".join(map(str, a[990:1000]))) |