FIBONACCI

=FIBONACCI(n)

n
integer, the nth term of the sequence

calculates the nth term of a Fibonacci sequence

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
FIBONACCI !! recursive !! calculates the nth term of the famous Fibonacci sequence . This is more of a fun quest than a useful function. ( did this on a YT channel also, had fun with Rico about this).
This reflects how limited our computers are. You will be surprised. This time is not about recursion "iterations" limit, is about the limit of the number of calculations that a computer can perform.
Open a new workbook, define the lambda FIBONACCI. Very important, first, try values of n less then 20!! . Call FIBONACC(15) ...(19) ..etc. and increase it bit by bit.
For what number "n" do you think that your computer will start struggling giving you the answer?? Share with us here, if you please, how long it took your computer to calculate FIBONACCI(35)..(38) and (40). Eventually what type of computer you are using. Processor ,RAM etc. After all, 40 is a very small number.? Give it a try!!
Note: Fibonacci sequence is this one : 1,1,2,3,5,8,13,21,34,55,89,144....the value of n term is the sum of the previous 2 terms fib( n)=fib(n-1) + fib(n-2), and fib(1)=1,fib(2)=1
Fortunately , Fibonacci has also an explicit solution (non recursive), you can define another lambda to check the results FIB( n)=LAMBDA( n,LET(a,SQRT(5),x,((1+a)/2)^n,y,((1-a)/2)^n,1/a*(x-y)))
Excel Formula:
=LAMBDA(n,IF(n<3,1,FIBBONACCI(n-1)+FIBONACCI(n-2)))
LAMBDA 6.0.xlsx
ABCDEFGH
1FIBONACCIrecursiveckeck(non recursive)
2n value=FIBONACCI(B3)=FIB(B3)time(can use phone's stopwatch)
315610610instant
41825842584instant
52067656765instant
6308320408320401s
73592274659227465?sshare this
8383908816939088169?svalues
940102334155102334155?swith us ?
10
FIBONACCI post
Cell Formulas
RangeFormula
C2:D2C2=FORMULATEXT(C3)
C3:C9C3=FIBONACCI(B3)
D3:D9D3=FIB(B3)
 
Upvote 0
RRA(a) Reversed Recursive Adding !! recursive !!
Excel Formula:
=LAMBDA(a,
    LET(l,LEN(a),m,MAX(l),c,COLUMNS(a),r,SEQUENCE(m),s,SEQUENCE(,c+m-1)-r+1,
       b,MMULT(SEQUENCE(,m)^0,IFERROR((s>0)*(s<=c)*INDEX(MID(REPLACE(a,1,0,REPT(0,m-l)),r,1),m-r+1,s),0)),
       IF(AND(LEN(b)=1),FILTER(b,SEQUENCE(,COLUMNS(b))<=XMATCH(TRUE,b<>0,,-1)),RRA(b))
    )
)
The only modifications made to RA (replace one r to m-r+1)
...INDEX(MID(REPLACE(a,1,0,REPT(0,m-l)),r,1),r,s)…to ...INDEX(MID(REPLACE(a,1,0,REPT(0,m-l)),r,1),m-r+1,s)
and to last part:
instead of filtering out leading 0's we have to filter out trailing 0's
… SEQUENCE(,COLUMNS(b))>=XMATCH(TRUE,b<>0) .. to … SEQUENCE(,COLUMNS(b))<=XMATCH(TRUE,b<>0,,-1)
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMNOPQRSTUVW
1Part 3. RRA. Reverse Recursive Adding Concept. Adding reversed numbers aligned to the left.
2No leading 0's are necessary and results will always be reversed.
3
4same example used for RAwhy results will stay reversed
55
600988
78989
8=RRA(N5+8)
9reversed or flipped array31
10
11898
12989831
13
14171798=RRA(N11:O11+N12:O12)
1512
16inserting 0's
17*17170908notice that even from early stages using RRA will keep the
18results reversed and aligned to the left.
19this time will extract last digits as first rows,
20scnd digits to the left as scnd row+ offset to the right, etc.see exact construction, next post
217798
221100
23
24781080
25
2610 has 2 digits, loop the process from *
270708100800
28
2978080
3000100
31
32780900
33
34filtering out trailing 0's
357809
36
377809 is reversed 9087
38
LNF 3
Cell Formulas
RangeFormula
N8,N14N8=FORMULATEXT(N9)
N9:O9N9=RRA(N5+8)
N12N12=RRA(N9)
B14:E14B14=B11:E11+B12:E12
N15:O15N15=RRA(N11:O11+N12:O12)
B24:F24B24=B21:F21+B22:F22
B32:G32B32=B29:G29+B30:G30
Dynamic array formulas.
 
LNF( n ) Large Number Fibonacci calls RRA.
Excel Formula:
=LAMBDA(n,
    LET(f,IF({1,0},1,0),
       r,REDUCE(0,SEQUENCE( n),LAMBDA(v,i,LET(s,SEQUENCE(i),x,IFNA(INDEX(v,i-2,),0),y,INDEX(v,i-1,),z,RRA(x+y),w,IF(COLUMNS(z)=1,INDEX(z,{1,2}),z),IF(s<3,f,IF(s=i,IFERROR(w,0),v))))),
       x,INDEX(r,n,),m,COLUMNS(x),
       CONCAT(INDEX(x,SEQUENCE(,m,m,-1)))
    )
)
RRA(a)
Excel Formula:
=LAMBDA(a,
    LET(l,LEN(a),m,MAX(l),c,COLUMNS(a),r,SEQUENCE(m),s,SEQUENCE(,c+m-1)-r+1,
       b,MMULT(SEQUENCE(,m)^0,IFERROR((s>0)*(s<=c)*INDEX(MID(REPLACE(a,1,0,REPT(0,m-l)),r,1),m-r+1,s),0)),
       IF(AND(LEN(b)=1),FILTER(b,SEQUENCE(,COLUMNS(b))<=XMATCH(TRUE,b<>0,,-1)),RRA(b))
    )
)
These are the only functions we need to calculate large Fibonacci numbers.
The cost we have to pay is in calculation time. A lot of rows add up to the total number of iterations, and this is slowing down the process.
If we are patient enough, the function is capable of calculating up to F 156787 (result will have 32767 digits) without running in any other type of limitation.
This is how array construction works, followed by some large numbers calculations.
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMN
1LNF Large Number Fibonacci. The function.
2
3This is how LNF construction using RRA will look, first part
4B7: =LAMBDA(n,LET(f,IF({1,0},1,0),r,REDUCE(0,SEQUENCE(n),LAMBDA(v,i,LET(s,SEQUENCE(i),x,IFERROR(INDEX(v,i-2,),0), y,INDEX(v,i-1,),z,RRA(x+y),w,IF(COLUMNS(z)=1,INDEX(z,{1,2}),z),IF(s<3,f,IF(s=i,IFERROR(w,0),v))))),r))(21)
5
6
710#N/A#N/A#N/ALNF last part, extracting, reversing and concat n th row
810#N/A#N/A#N/A… x,INDEX(r,n,),m,COLUMNS(x),CONCAT(INDEX(x,SEQUENCE(,m,m,-1)))))
920#N/A#N/A#N/A
1030#N/A#N/A#N/A=LET(x,INDEX(B7#,21,),m,COLUMNS(x),CONCAT(INDEX(x,SEQUENCE(,m,m,-1))))
1150#N/A#N/A#N/A10946
1280#N/A#N/A#N/A
1331#N/A#N/A#N/A=LNF(21)
1412#N/A#N/A#N/A10946
1543#N/A#N/A#N/A
1655#N/A#N/A#N/A
1798#N/A#N/A#N/A
18441#N/A#N/A
19332#N/A#N/A
20773#N/A#N/A
21016#N/A#N/A
22789#N/A#N/A
237951#N/A
244852#N/A
251814#N/A
265676#N/A
2764901
28
LNF 4
Cell Formulas
RangeFormula
B7:F27B7=LAMBDA(n,LET(f,IF({1,0},1,0),r,REDUCE(0,SEQUENCE(n),LAMBDA(v,i,LET(s,SEQUENCE(i),x,IFNA(INDEX(v,i-2,),0),y,INDEX(v,i-1,),z,RRA(x+y),w,IF(COLUMNS(z)=1,INDEX(z,{1,2}),z),IF(s<3,f,IF(s=i,IFERROR(w,0),v))))),r))(21)
H10,H13H10=FORMULATEXT(H11)
H11H11=LET(x,INDEX(B7#,21,),m,COLUMNS(x),CONCAT(INDEX(x,SEQUENCE(,m,m,-1))))
H14H14=LNF(21)
Dynamic array formulas.
 
Calculation times.
Attached, screen capture from Wolfram Alpha F 5000 .
LARGE NUM FIBONACCI.xlsx
ABCDE
1Large Number Fibonacci. Calculation times.
2
3calc timechar length=LNF(1000)
49.69s20943466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875
5=LNF(1222)
618.39s2561079969233398873236032844293301653524976362936180771647488810146258428573892502087348778468320557178381011519862132501167447528535147702705724587018435771357806213382154720957836431378302535456607039572026816018665428571946697730583021094317239872427815311
7=LNF(1477)
832.61s309211475298697902185255785861961179135570552502746803252174956226558634024323947666637137823932524397611864671566211908330263377425204552074188208686993669123754004340250943108709212299180422293009765404930508242975773774612140021599477983006713536106549441161323499077298115887067363710153036315849480388057657
9=LNF(2000)
101m19.62s4184224696333392304878706725602341482782579852840250681098010280137314308584370130707224123599639141511088446087538909603607640194711643596029271983312598737326253555802606991585915229492453904998722256795316982874482472992263901833716778060607011615497886719879858311468870876264597369086722884023654422295243347964480139515349562972087652656069529806499841977448720155612802665404554171717881930324025204312082516817125
11=LNF(5000)
1219m56.37s10453878968454388325633701916308325905312082127714646245106160597214895550139044037097010822916462210669479293452858882973813483102008954982940361430156911478938364216563944106910214505634133706558656238254656700712525929903854933813928836378347518908762970712033337052923107693008518093849801803847813996748881765554653788291644268912980384613778969021502293082475666346224923071883324803280375039130352903304505842701147635242270210934637699104006714174883298422891491273104054328753298044273676822977244987749874555691907703880637046832794811358973739993110106219308149018570815397854379195305617510761053075688783766033667355445258844886241619210553457493675897849027988234351023599844663934853256411952221859563060475364645470760330902420806382584929156452876291575759142343809142302917491088984155209854432486594079793571316841692868039545309545388698114665082066862897420639323438488465240988742395873801976993820317174208932265468879364002630797780058759129671389634214252579116872755600360311370547754724604639987588046985178408674382863125
13
14=LAMBDA(s,c,MID(s,SEQUENCE(ROUNDUP((LEN(s)/c),0),,1,c),c))(D12,100)
153878968454388325633701916308325905312082127714646245106160597214895550139044037097010822916462210669
164792934528588829738134831020089549829403614301569114789383642165639441069102145056341337065586562382
175465670071252592990385493381392883637834751890876297071203333705292310769300851809384980180384781399
186748881765554653788291644268912980384613778969021502293082475666346224923071883324803280375039130352
199033045058427011476352422702109346376991040067141748832984228914912731040543287532980442736768229772
204498774987455569190770388063704683279481135897373999311010621930814901857081539785437919530561751076
211053075688783766033667355445258844886241619210553457493675897849027988234351023599844663934853256411
229522218595630604753646454707603309024208063825849291564528762915757591423438091423029174910889841552
230985443248659407979357131684169286803954530954538869811466508206686289742063932343848846524098874239
245873801976993820317174208932265468879364002630797780058759129671389634214252579116872755600360311370
25547754724604639987588046985178408674382863125
26
LNF 5
Cell Formulas
RangeFormula
C4,C12,C10,C8,C6C4=LEN(D4)
D3,D5,D7,D9,D11,D14D3=FORMULATEXT(D4)
D4D4=LNF(1000)
D6D6=LNF(1222)
D8D8=LNF(1477)
D10D10=LNF(2000)
D12D12=LNF(5000)
D15:D25D15=LAMBDA(s,c,MID(s,SEQUENCE(ROUNDUP((LEN(s)/c),0),,1,c),c))(D12,100)
Dynamic array formulas.
 

Attachments

  • FIB 5000.png
    FIB 5000.png
    167.6 KB · Views: 22
To prove that LNF is recursive efficient, let's calculate the frequency distributions of iterations calculated by RRA for every 2 rows, maximum number of iterations needed by 2 rows, total number of iterations for entire array.
For that I will use a tool function that counts the iterations. 0 iterations means that the exit condition is met after first calculation.
I_RRA(a,[i ]) where i argument counts total number of iterations after exiting condition is met
Excel Formula:
=LAMBDA(a,[i ],
     LET(l,LEN(a),m,MAX(l),c,COLUMNS(a),r,SEQUENCE(m),s,SEQUENCE(,c+m-1)-r+1,
        b,MMULT(SEQUENCE(,m)^0,IFERROR((s>0)*(s<=c)*INDEX(MID(REPLACE(a,1,0,REPT(0,m-l)),r,1),m-r+1,s),0)),
        IF(AND(LEN(b)=1),i,I_RRA(b,i+1))
    )
)
Also, to be much easier will have ARLNF Array Reversed Large Number Fibonacci, which will return entire array, ( LNF without last part of extracting last row, reversing and concat, but without the NA()'s )
ARLNF( n)
Excel Formula:
=LAMBDA(n,
    LET(f,IF({1,0},1,0),
      r,REDUCE(0,SEQUENCE(n),LAMBDA(v,i,LET(s,SEQUENCE(i),x,IFNA(INDEX(v,i-2,),0),y,INDEX(v,i-1,),z,RRA(x+y),w,IF(COLUMNS(z)=1,INDEX(z,{1,2}),z),IF(s<3,f,IF(s=i,IFERROR(w,0),v))))),
     IFNA(r,"")
    )
)
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMNOPQ
1ARLNF Array Reversed Large Number Fibonacci
2
3n=ARLNF(70)
4110
5210
6320
7430
8550
9680
10731
11812
12943
131055
141198
1512441
1613332
1714773
1815016
1916789
20177951
21184852
22191814
23205676
242164901
252211771
262375682
272486364
282552057
2926393121
3027814691
3128118713
3229922415
3330040238
34319626431
35329038712
36338754253
37347882075
38355647229
393625303941
403771875142
413896188093
423968954236
4340551433201
4441141085561
4542692419762
4643734494334
4744337804107
48450713094311
49463091136381
50473705121792
51486796257084
52499402478777
535052096268521
545147011056302
555299008215923
565337119261335
575427217576268
5855544268385931
5956717334158522
6057261692534563
6158978927682195
6259140620227659
63600295578008451
64611691870374052
65621887359372504
66632489130747556
676432775890201601
686556577108676171
696688253009877772
706735821207554944
716814184206432727
7269499064030966711
7370531907094293091
74
LNF 6
Cell Formulas
RangeFormula
B3B3=FORMULATEXT(B4)
A4:A73A4=SEQUENCE(70)
B4:P73B4=ARLNF(70)
Dynamic array formulas.
 
Iteration's frequency distribution for F 1000
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1Entire Fibbonacci array for n=1000=SEQUENCE(C1)
2=LET(a,F4:HF4,b,F5:HF5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
3max nr.n=ARLNF(C1)
4iterations1iterations10
5btwn 2 rows2010
6=MAX(E5:E1003)3020
754030
85050
9total nr. of6080
10iterations7031
11entire array8012
12=SUM(E4:E1003)9043
13128910055
14itererations11098
15frequencyfrequency120441
16binsdistribution130332
17090140773
181575150016
192291160789
203411707951
21411804852
22511901814
2302005676
2421064901
25for what n we have max nr. iterations22011771
26=FILTER(D4#,ISNUMBER(XMATCH(E4:E1003,A7)))23075682
2789924186364
2825052057
29260393121
30270814691
31280118713
32290922415
33300040238
343109626431
353209038712
363318754253
373407882075
383515647229
3936025303941
4037071875142
4138096188093
4239168954236
43401551433201
44410141085561
45420692419762
46431734494334
47441337804107
484500713094311
494603091136381
504703705121792
514816796257084
524919402478777
5350152096268521
5451047011056302
5552099008215923
5653037119261335
5754027217576268
58550544268385931
59560717334158522
60570261692534563
LNF 7
Cell Formulas
RangeFormula
D1,E2D1=FORMULATEXT(D4)
F3,A26,A12,A6F3=FORMULATEXT(F4)
D4:D1003D4=SEQUENCE(C1)
F4:HF1003F4=ARLNF(C1)
A7A7=MAX(E5:E1003)
A13A13=SUM(E4:E1003)
A17:A22A17=SEQUENCE(A7+1)-1
B17:B23B17=FREQUENCY(E5:E1003,A17#)
A27A27=FILTER(D4#,ISNUMBER(XMATCH(E4:E1003,A7)))
E5:E60E5=LET(a,F4:HF4,b,F5:HF5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
Dynamic array formulas.
 
Iteration's frequency distribution for F 5000
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1Entire Fibbonacci array for n=5000=SEQUENCE(C1)
2=LET(a,F4:ANJ4,b,F5:ANJ5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
3max nr.n=ARLNF(C1)
4iterations1iterations10
5btwn 2 rows2010
6=MAX(E5:E5003)3020
764030
85050
9total nr. of6080
10iterations7031
11entire array8012
12=SUM(E4:E5003)9043
13993510055
14itererations11098
15frequencyfrequency120441
16binsdistribution130332
17090140773
1811008150016
1922900160789
2038891707951
2141011804852
225101901814
23612005676
24021064901
25for what n we have max nr. iterations22011771
26=FILTER(D4#,ISNUMBER(XMATCH(E4:E5003,A7)))23075682
27220124186364
2825052057
29260393121
30270814691
31280118713
32290922415
33300040238
343109626431
353209038712
363318754253
373407882075
383515647229
3936025303941
4037071875142
4138096188093
4239168954236
43401551433201
44410141085561
45420692419762
46431734494334
47441337804107
484500713094311
494603091136381
504703705121792
514816796257084
524919402478777
5350152096268521
5451047011056302
5552099008215923
5653037119261335
5754027217576268
58550544268385931
59560717334158522
60570261692534563
LNF 7
Cell Formulas
RangeFormula
D1,E2D1=FORMULATEXT(D4)
F3,A26,A12,A6F3=FORMULATEXT(F4)
D4:D5003D4=SEQUENCE(C1)
F4:ANJ5003F4=ARLNF(C1)
A7A7=MAX(E5:E5003)
A13A13=SUM(E4:E5003)
A17:A23A17=SEQUENCE(A7+1)-1
B17:B24B17=FREQUENCY(E5:E5003,A17#)
A27A27=FILTER(D4#,ISNUMBER(XMATCH(E4:E5003,A7)))
E5:E60E5=LET(a,F4:ANJ4,b,F5:ANJ5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
Dynamic array formulas.
 
Last edited:
LNF for n=10,000
Attached, screen capture from Wolfram Alpha F 10,000 . Fibonacci 10000 - Wolfram|Alpha
LARGE NUM FIBONACCI.xlsx
ABCD
1Large Number Fibonacci n=10,000
2
3char length=LNF(10000)
4209033644764876431783266621612005107543310302148460680063906564769974680081442166662368155595513633734025582065332680836159373734790483865268263040892463056431887354544369559827491606602099884183933864652731300088830269235673613135117579297437854413752130520504347701602264758318906527890855154366159582987279682987510631200575428783453215515103870818298969791613127856265033195487140214287532698187962046936097879900350962302291026368131493195275630227837628441540360584402572114334961180023091208287046088923962328835461505776583271252546093591128203925285393434620904245248929403901706233888991085841065183173360437470737908552631764325733993712871937587746897479926305837065742830161637408969178426378624212835258112820516370298089332099905707920064367426202389783111470054074998459250360633560933883831923386783056136435351892133279732908133732642652633989763922723407882928177953580570993691049175470808931841056146322338217465637321248226383092103297701648054726243842374862411453093812206564914032751086643394517512161526545361333111314042436854805106765843493523836959653428071768775328348234345557366719731392746273629108210679280784718035329131176778924659089938635459327894523777674406192240337638674004021330343297496902028328145933418826817683893072003634795623117103101291953169794607632737589253530772552375943788434504067715555779056450443016640119462580972216729758615026968443146952034614932291105970676243268515992834709891284706740862008587135016260312071903172086094081298321581077282076353186624611278245537208532365305775956430072517744315051539600905168603220349163222640885248852433158051534849622434848299380905070483482449327453732624567755879089187190803662058009594743150052402532709746995318770724376825907419939632265984147498193609285223945039707165443156421328157688908058783183404917434556270520223564846495196112460268313970975069382648706613264507665074611512677522748621598642530711298441182622661057163515069260029861704945425047491378115154139941550671256271197133252763631939606902895650288268608362241082050562430701794976171121233066073310059947366875
5
6=LAMBDA(s,c,MID(s,SEQUENCE(ROUNDUP((LEN(s)/c),0),,1,c),c))(D4,120)
7336447648764317832666216120051075433103021484606800639065647699746800814421666623681555955136337340255820653326808361593
8737347904838652682630408924630564318873545443695598274916066020998841839338646527313000888302692356736131351175792974378
9544137521305205043477016022647583189065278908551543661595829872796829875106312005754287834532155151038708182989697916131
10278562650331954871402142875326981879620469360978799003509623022910263681314931952756302278376284415403605844025721143349
11611800230912082870460889239623288354615057765832712525460935911282039252853934346209042452489294039017062338889910858410
12651831733604374707379085526317643257339937128719375877468974799263058370657428301616374089691784263786242128352581128205
13163702980893320999057079200643674262023897831114700540749984592503606335609338838319233867830561364353518921332797329081
14337326426526339897639227234078829281779535805709936910491754708089318410561463223382174656373212482263830921032977016480
15547262438423748624114530938122065649140327510866433945175121615265453613331113140424368548051067658434935238369596534280
16717687753283482343455573667197313927462736291082106792807847180353291311767789246590899386354593278945237776744061922403
17376386740040213303432974969020283281459334188268176838930720036347956231171031012919531697946076327375892535307725523759
18437884345040677155557790564504430166401194625809722167297586150269684431469520346149322911059706762432685159928347098912
19847067408620085871350162603120719031720860940812983215810772820763531866246112782455372085323653057759564300725177443150
20515396009051686032203491632226408852488524331580515348496224348482993809050704834824493274537326245677558790891871908036
21620580095947431500524025327097469953187707243768259074199396322659841474981936092852239450397071654431564213281576889080
22587831834049174345562705202235648464951961124602683139709750693826487066132645076650746115126775227486215986425307112984
23411826226610571635150692600298617049454250474913781151541399415506712562711971332527636319396069028956502882686083622410
2482050562430701794976171121233066073310059947366875
25
LNF 9
Cell Formulas
RangeFormula
D3,D6D3=FORMULATEXT(D4)
C4C4=LEN(D4)
D4D4=LNF(10000)
D7:D24D7=LAMBDA(s,c,MID(s,SEQUENCE(ROUNDUP((LEN(s)/c),0),,1,c),c))(D4,120)
Dynamic array formulas.
 

Attachments

  • FIB 10000.png
    FIB 10000.png
    177 KB · Views: 13
Iteration's frequency distribution for F 10,000
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1Entire Fibbonacci array for n=10000=SEQUENCE(C1)
2=LET(a,F4:CBO4,b,F5:CBO5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
3max nr.n=ARLNF(C1)
4iterations1iterations10
5btwn 2 rows2010
6=MAX(E5:E10003)3020
764030
85050
9total nr. of6080
10iterations7031
11entire array8012
12=SUM(E4:E10003)9043
132273610055
14itererations11098
15frequencyfrequency120441
16binsdistribution130332
17090140773
1811017150016
1925416160789
20330661707951
2143651804852
225411901814
23642005676
24021064901
25for what n we have max nr. iterations22011771
26=FILTER(D4#,ISNUMBER(XMATCH(E4:E10003,A7)))23075682
27220124186364
28629925052057
298790260393121
309780270814691
31280118713
32290922415
33300040238
343109626431
353209038712
363318754253
373407882075
383515647229
3936025303941
4037071875142
4138096188093
4239168954236
43401551433201
44410141085561
45420692419762
46431734494334
47441337804107
484500713094311
494603091136381
504703705121792
514816796257084
524919402478777
5350152096268521
5451047011056302
5552099008215923
5653037119261335
5754027217576268
58550544268385931
59560717334158522
60570261692534563
LNF 8
Cell Formulas
RangeFormula
D1,E2D1=FORMULATEXT(D4)
F3,A26,A12,A6F3=FORMULATEXT(F4)
D4:D10003D4=SEQUENCE(C1)
F4:CBO10003F4=ARLNF(C1)
A7A7=MAX(E5:E10003)
A13A13=SUM(E4:E10003)
A17:A23A17=SEQUENCE(A7+1)-1
B17:B24B17=FREQUENCY(E5:E10003,A17#)
A27:A30A27=FILTER(D4#,ISNUMBER(XMATCH(E4:E10003,A7)))
E5:E60E5=LET(a,F4:CBO4,b,F5:CBO5,y,FILTER(b,b<>""),z,INDEX(a,SEQUENCE(,COLUMNS(y))),x,IF(z="",0,z),I_RRA(x+y))
Dynamic array formulas.
 
Function of "n" that estimates total number of iterations "ni" for calculating LNF(n )
ni(n )=5E-05*n^2+1.8851*n-676.31
LARGE NUM FIBONACCI.xlsx
ABCDEFGHIJKL
1=SCAN(0,'LNF 8'!E5:E10003,LAMBDA(v,x,v+x))
2iterations=XLOOKUP(D6#,A4#,B4#)
3nrunning tot=0.00005*D6#^2+1.8851*D6#-676.31=0.00005*H6#^2+1.8851*H6#-676.31
420totalfunction'sfunction's
530niterationsestimationnestimation
64050051727910001,259
750100012891,25920003,294
860150021982,26430005,429
970200031683,29440007,664
1080250042024,34950009,999
1190300052945,429600012,434
12100350064386,534700014,969
13110400075677,664800017,604
14120450087368,819900020,340
15130500099359,9991000023,175
1614055001114911,2041100026,110
1715060001238812,4341200029,145
1816065001364013,6891300032,280
1917070001489614,9691400035,515
2018075001616516,2741500038,850
2119080001747217,6041600042,285
2220085001877818,9601700045,820
2321090002009220,3401800049,455
2422095002141721,7451900053,191
25230100002273623,1752000057,026
262412100060,961
272512200064,996
282612300069,131
292712400073,366
302812500077,701
312912600082,136
323012700086,671
333112800091,306
343212900096,042
3533230000100,877
3634231000105,812
3735332000110,847
3836333000115,982
3937334000121,217
4038335000126,552
4139436000131,987
4240537000137,522
4341538000143,157
4442539000148,893
4543640000154,728
4644741000160,663
4745742000166,698
4846743000172,833
4947744000179,068
5048845000185,403
5149946000191,838
52501047000198,373
53511048000205,008
54521049000211,744
55531050000218,579
56541051000225,514
57551052000232,549
58561053000239,684
59571054000246,919
60581155000254,254
61591256000261,689
62601357000269,224
63611358000276,859
64621459000284,595
65631560000292,430
666416
LNF 10
Cell Formulas
RangeFormula
B1,F3,I3B1=FORMULATEXT(B4)
E2E2=FORMULATEXT(E6)
A4:A10002A4=SEQUENCE(10000-1)+1
B4:B10002B4=SCAN(0,'LNF 8'!E5:E10003,LAMBDA(v,x,v+x))
D6:D25D6=SEQUENCE(20,,500,500)
E6:E25E6=XLOOKUP(D6#,A4#,B4#)
F6:F25F6=0.00005*D6#^2+1.8851*D6#-676.31
H6:H65H6=SEQUENCE(60,,1000,1000)
I6:I65I6=0.00005*H6#^2+1.8851*H6#-676.31
Dynamic array formulas.
 
Lots of chatter here, but no mention that the LAMBDA posted has a typo. Posted is
"=LAMBDA(n,IF(n<3,1,FIBBONACCI(n-1)+FIBONACCI(n-2)))", but for any value 3 or more it just generates a #NAME! error. Should be
Excel Formula:
=LAMBDA(n,IF(n<3,1,FIBONACCI(n-1)+FIBONACCI(n-2)))
Just sayin'.
 

Forum statistics

Threads
1,223,926
Messages
6,175,429
Members
452,641
Latest member
Arcaila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top