<p><pre><code>    def fib(n):
        return (4 &lt;&lt; n*(3+n)) &#x2F;&#x2F; ((4 &lt;&lt; 2*n) - (2 &lt;&lt; n) - 1) &amp; ((2 &lt;&lt; n) - 1)
</code></pre>
Looks like there&#x27;s a small bug in this code.<p>fib(0) = 0<p>fib(1) = 1<p>fib(2) = 2<p>fib(3) = 3<p>fib(4) = 5<p>etc.<p>But there should be two values at the beginning that evaluate to 1. (Whether it&#x27;s fib(0) and fib(1), vs. fib(1) and fib(2) is just a matter of convention. But there should definitely be two of them.)