F(1) 10^-1 + F(2) 10^-2 + F(3) 10^-3 + F(4) 10^4 + F(5) 10^5 + ...
1 * 0.1 + 1 * 0.01 + 2 * 0.001 + 3 * 0.0001 + 5 * 0.00001 + ...
So it's no surprise that the first digits of 1/89 contain the Fibonacci series as it's just 10/89 shifted by one decimal place.The pattern breaks down eventually because you overflow a single digit. But you can delay how long until this occurs by substituting in smaller powers of 10. For example if we substitute x = 10^-3 we get 1000/998999 or
0.0010010020030050080130210340550891442333776109885995881...
I have also used this neat fact to make this golfed loopless/recursionless exact (no floating-point arithmetic) Python implementation of Fibonacci, by substituting in binary powers instead: F=lambda n:(4<<n*(3+n))//((4<<2*n)-(2<<n)-1)&~-(2<<n)
If someone is not aware of generating functions it's essentially impossible to understand why this generates Fibonacci.>If someone is not aware of generating functions it's essentially impossible to understand why this generates Fibonacci.
??
I think it's pretty interesting that this sequence can be hiding within the 44 repeating digits of the decimal expansion of 1/89:
0.1123595505617977528089887640449438202247191011235… [1]
A proof can be found here: https://www.cantorsparadise.com/why-does-1-89-represent-the-...
[1] I couldn't easily find this many digits online, but here's a Python program to calculate them:
num = int(input('numerator: '))
denom = int(input('denom: '))
sig = int(input('significant digits: '))
div = num // denom
rem = num % denom
print(f'{div}.{(rem*(10**sig))//denom}')Off by an OoM.
1+1 = 2
1+2 = 3
2+3 = 5
3+5 = 9???8+5=13
I assume the '1' of the '13' carries into the 8 => 8+1=9
Same for the numbers after that.
Yet again, foiled by forgetting to carry the one!!!! Those are the kinds of "finds" that I'm way too out of practice in searching for patterns to have noticed the answer. Or I'm just too lazy and out of practice and called it quits too quickly. Now, show me a syntax error of missing }, ), ], etc, and I'll find that pattern with/without an IDE!
Add these up and you get closer and closer to 1 / 89:
0.0
0.01
0.001
0.0002
0.00003
0.000005
0.0000008
0.00000013
0.000000021
0.0000000034
0.00000000055
0.000000000089
0.0000000000144
0.00000000000233
0.000000000000377
0.0000000000000610
0.00000000000000987
0.000000000000001597
0.0000000000000002584
0.00000000000000004181
0.000000000000000006765
0.0000000000000000010946
0.00000000000000000017711
0.000000000000000000028657
0.0000000000000000000046368
0.00000000000000000000075025
0.000000000000000000000121393
0.0000000000000000000000196418
0.00000000000000000000000317811
0.000000000000000000000000514229
0.0000000000000000000000000832040
0.00000000000000000000000001346269
0.000000000000000000000000002178309
0.0000000000000000000000000003524578
0.00000000000000000000000000005702887
0.000000000000000000000000000009227465
0.0000000000000000000000000000014930352
0.00000000000000000000000000000024157817
0.000000000000000000000000000000039088169
0.0000000000000000000000000000000063245986
0.00000000000000000000000000000000102334155
0.000000000000000000000000000000000165580141
0.0000000000000000000000000000000000267914296
0.00000000000000000000000000000000000433494437
0.000000000000000000000000000000000000701408733
0.0000000000000000000000000000000000001134903170
0.00000000000000000000000000000000000001836311903
0.000000000000000000000000000000000000002971215073
0.0000000000000000000000000000000000000004807526976
0.00000000000000000000000000000000000000007778742049
0.000000000000000000000000000000000000000012586269025
0.0000000000000000000000000000000000000000020365011074
0.00000000000000000000000000000000000000000032951280099
0.000000000000000000000000000000000000000000053316291173
0.0000000000000000000000000000000000000000000086267571272
0.00000000000000000000000000000000000000000000139583862445
0.000000000000000000000000000000000000000000000225851433717
0.0000000000000000000000000000000000000000000000365435296162
0.00000000000000000000000000000000000000000000000591286729879
+ 0.000000000000000000000000000000000000000000000000956722026041
--------------------------------------------------------------
0.011235955056179775280898876404494382022471910112174867308031 ≈ 1 / 89
==============================================================
For those interested in running this with more iterations, here is a Python script: from decimal import *
n = 60
getcontext().prec = n
t = Decimal(0)
p, q = 0, 1
for i in range(1, n+1):
s = f'0.{p:0{i}}'
print(s)
t += Decimal(s)
p, q = q, p+q
print('-' * (n + 2))
print(t, '≈ 1 / 89')
print('=' * (n + 2))
print()
print(1 / t)I still find 'bc' usefull when needing many digits
$ echo 'scale=100;1/89'|bc