Binary Representation
There's a very clean way of figuring out which set of Fibonacci values you need. We'll show how to find the chain you want for by working backwards.
- First, write out your number in binary.
- The last bit of the number determines whether it's odd or even. If it's even, then the chain needs to end by going from . If it's odd, the chain needs to end by going from .
- Now we know the last step of the chain. We can simply repeat this process to find the next-to-last step, and so on and so forth.
- At the end, we simply apply that chain in order.
We always start with , which maps nicely to the fact that any binary number starts with a . This elegant correspondence gives us exactly what we need.
Binary Representation
There's a very clean way of figuring out which set of Fibonacci values you need. We'll show how to find the chain you want for by working backwards.
- First, write out your number in binary.
- The last bit of the number determines whether it's odd or even. If it's even, then the chain needs to end by going from . If it's odd, the chain needs to end by going from .
- Now we know the last step of the chain. We can simply repeat this process to find the next-to-last step, and so on and so forth.
- At the end, we simply apply that chain in order.
We always start with , which maps nicely to the fact that any binary number starts with a . This elegant correspondence gives us exactly what we need.