How to resolve the algorithm Fibonacci n-step number sequences step by step in the 11l programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Fibonacci n-step number sequences step by step in the 11l programming language
Table of Contents
Problem Statement
These number series are an expansion of the ordinary Fibonacci sequence where: For small values of
n
{\displaystyle n}
, Greek numeric prefixes are sometimes used to individually name each series. Allied sequences can be generated where the initial values are changed:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Fibonacci n-step number sequences step by step in the 11l programming language
Source code in the 11l programming language
T Fiblike
Int addnum
[Int] memo
F (start)
.addnum = start.len
.memo = copy(start)
F ()(n)
X.try
R .memo[n]
X.catch IndexError
V ans = sum((n - .addnum .< n).map(i -> (.)(i)))
.memo.append(ans)
R ans
V fibo = Fiblike([1, 1])
print((0.<10).map(i -> fibo(i)))
V lucas = Fiblike([2, 1])
print((0.<10).map(i -> lucas(i)))
L(n, name) zip(2..10, ‘fibo tribo tetra penta hexa hepta octo nona deca’.split(‘ ’))
V fibber = Fiblike([1] [+] (0 .< n - 1).map(i -> Int(2 ^ i)))
print(‘n=#2, #5nacci -> #. ...’.format(n, name, (0.<15).map(i -> String(@fibber(i))).join(‘ ’)))
You may also check:How to resolve the algorithm Langton's ant step by step in the CoffeeScript programming language
You may also check:How to resolve the algorithm Zeckendorf number representation step by step in the Python programming language
You may also check:How to resolve the algorithm Sierpinski square curve step by step in the C++ programming language
You may also check:How to resolve the algorithm Multifactorial step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Rosetta Code/Find unimplemented tasks step by step in the Perl programming language