Mateja
(Mateja)
April 23, 2020, 2:49pm
#1
The Fibonacci sequence is the series of numbers : 1, 1, 2, 3, 5, 8, 13, 21, 34, … The next number is found by adding up the two numbers before it. (source)
Your task is to ask for a number and the program should return the digit of the series.
Sample imputs:
fibonacci(8) => 3 #1, 1, 2, 3, 5, 8, 1𝟯,...
fibonacci(18) => 4
fibonacci(24) => 7
fibonacci(234) => 3
fibonacci(1834) => 5
Have fun!
btw, start the sequence from 1 instead from 0.
1 Like
Peter
(Moderator)
April 23, 2020, 2:53pm
#2
This is a variation of
This is your quest for today:
The Fibonacci Sequence is the sequence of numbers (Fibonacci Numbers) whose sum is the two preceding numbers (e.g. 0, 1, 1, 2, 3, etc). Using 0 and 1 as the starting values, create a procedure that returns an result containing all of the Fibonacci numbers less than 255.
Great to see the daily challenges again. Thanks @Mateja
2 Likes
Mateja
(Mateja)
April 23, 2020, 3:27pm
#4
I will be posting my solution here, but if you want to solve this I suggest not opening the answer.
Solution
You can also download my original Python source code:
fibonacciSequence/src-py at master · ontstudios/fibonacciSequence · GitHub
1 Like
Peter
(Moderator)
April 25, 2020, 7:20am
#5
Hi @Mateja ,
a little tip. The initialize local block is a mutator block. Any block with the blue gear sign is one.
So you could have made your variables block like this.
You are using less blocks and it looks tidier.
1 Like
Mateja
(Mateja)
April 25, 2020, 7:21am
#6
Yes,
Thanks. This was my first time using these initialize local blocks, so I really didnt know what to do. I was skeptical if my program would even work. Thanks Peter!
3 Likes
system
(system)
Closed
May 25, 2020, 7:21am
#7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.