Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,30 +1,3 @@
def prevPowTwo(n):
'Gets the power of two that is less than or equal to the given input'
if ((n & -n) == n):
return n
else:
n -= 1
n |= n >> 1
n |= n >> 2
n |= n >> 4
n |= n >> 8
n |= n >> 16
n += 1
return (n/2)
>>> [i for i in fib_gen(11)]
def crazyFib(n):
'Crazy fast fibonacci number calculation'
powTwo = prevPowTwo(n)
q = r = i = 1
s = 0
while(i < powTwo):
i *= 2
q, r, s = q*q + r*r, r * (q + s), (r*r + s*s)
while(i < n):
i += 1
q, r, s = q+r, q, r
return q
[0,1,1,2,3,5,8,13,21,34,55]