omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / anti-primes / oracle.py
| 1 | # Independent reference for "Anti-primes" (Python 3, standard library only). |
| 2 | # expected.txt is this program's stdout; omc never produced it. |
| 3 | out, best, n = [], 0, 0 |
| 4 | while len(out) < 20: |
| 5 | n += 1 |
| 6 | k = sum(1 for d in range(1, n + 1) if n % d == 0) |
| 7 | if k > best: |
| 8 | best = k |
| 9 | out.append(n) |
| 10 | print("first 20 anti-primes: " + " ".join(map(str, out))) |