forked from FlatDigital/flatonacci
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflatonacci.py
More file actions
28 lines (20 loc) · 945 Bytes
/
flatonacci.py
File metadata and controls
28 lines (20 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Flatonacci secuence is a secuence which is result from the same given secuence
plus the sum of the last 3 numbers of the secuence.
The challenge is to create a flatonacci function that given a signature returns the first
n elements - signature included of the so seeded sequence. So, if we are to
start our Flatonacci sequence with [1, 1, 1] as a starting input (AKA signature) and n = 8,
we have this sequence:
[1, 1 ,1, 3, 5, 9, 17, 31]
Another example; if signature is the secuence [0, 0, 1] we should get some thing
like:
[0, 0, 1, 1, 2, 4, 7, 13, 24, ...]
- Signature will always contain 3 numbers
- n will always be a non-negative number
- if n == 0, then return an empty list and be ready for anything else which is not
clearly specified ;)
Note. Please note that we are gonna test the funcion against a lot of different signatures and n's
"""
def flatonacci(signature: list, n: int) -> list:
# happy coding
pass