Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-rosetta/blob/main/tasks/bell-numbers/oracle.py # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / tasks / bell-numbers / oracle.py` 17 lines ยท 623 bytes Raw Blame History 1 # Independent reference for "Bell numbers" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 import math 4 # Bell numbers by B(n+1) = sum C(n, k) B(k); the triangle rows by the Aitken array rule 5 B = [1] 6 for n in range(60): 7 B.append(sum(math.comb(n, k) * B[k] for k in range(n + 1))) 8 print("first 10 rows of the Bell triangle:") 9 r = [1] 10 for i in range(10): 11 print(" ".join(map(str, r))) 12 nr = [r[-1]] 13 for v in r: 14 nr.append(nr[-1] + v) 15 r = nr 16 print("first 15 Bell numbers: " + " ".join(map(str, B[:15]))) 17 print(f"B(49), the 50th Bell number: {B[49]}")