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/fibonacci-n-step-number-sequences/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 / fibonacci-n-step-number-sequences / oracle.py` 16 lines ยท 789 bytes Raw Blame History 1 # Independent reference for "Fibonacci n-step number sequences" (Python 3, standard library only). 2 # expected.txt is this program's stdout; omc never produced it. 3 names = {2: "fibonacci: ", 3: "tribonacci:", 4: "tetranacci:", 5: "pentanacci:", 6: "hexanacci: ", 4 7: "heptanacci:", 8: "octonacci: ", 9: "nonanacci: ", 10: "decanacci: "} 5 def nstep(seed, n, count): 6 a = list(seed) 7 while len(a) < count: 8 a.append(sum(a[-n:])) 9 return a[:count] 10 # the n-step sequence is seeded with the first n terms of the (n-1)-step one, starting from 1, 1 11 seed = [1, 1] 12 for n in range(2, 11): 13 if n > 2: 14 seed = nstep(seed, n - 1, n) 15 print(names[n] + "".join(f" {v}" for v in nstep(seed, n, 15))) 16 print("lucas: " + "".join(f" {v}" for v in nstep([2, 1], 2, 15)))