Fibonacci sequence
Even though I write software nearly everyday, I am not much of a mathematician, don’t get me wrong it’s both fascinating and required for many things in code, it’s just when it comes to formulas and formalities most of it goes over my head and requires some effort to understand, so with that out of the way I stumbled upon the Fibonacci Sequence the other day and was immediately fascinated by it, in a gist just imagine that your coding interview tells you to complete the following sequence of numbers and write a script to do so:
55, 89, 144, 233...?
If you’ve been exposed to Fibonacci numbers this will be obvious, but if not the simple trick is that each following number is the sum of the previous two, so 144
is the sum of 55
and 89
, if we add 144 + 233
we should get the next number 377
, then you can go on by adding 233 + 377
and so on.
In script form this is one popular ( according to Github Copilot ) way to make a Fibonacci sequence :
Here we populate a Python List via branching conditionals to take care of…