Introduction
If \$\newcommand{\fib}{\operatorname{fib}}\fib(x)\$ calculates the \$x\$th Fibonacci number, write a program that calculates \$\fib(\fib(m))\$ for any integer value of \$m \ge 0\$. (Of course, there will be practical limits based on the language, so lesser limits are acceptable. Also, it's okay to stop at \$m = 20\$, even if the language could in theory go higher.) Any means of calculation is acceptable.
Challenge
Write a program or function, in as few bytes of code as possible, that for any given positive integer input, will return the same output as function fibfib
in the following Python code:
fibs = [0, 1]
def fib(n):
global fibs
while len(fibs) <= n:
fibs.append(fibs[-2]+fibs[-1])
return fibs[n]
def fibfib(m):
return fib(fib(m))
You do not have to use the same or a similar algorithm; the output just has to be the same.
Example Input and Output
0 -> 0
1 -> 1
2 -> 1
3 -> 1
4 -> 2
5 -> 5
6 -> 21
7 -> 233
8 -> 10946
9 -> 5702887
10 -> 139583862445
15 -> 13582369791278266616906284494806735565776939502107183075612628409034209452901850178519363189834336113240870247715060398192490855
20 -> 2830748520089123910580483858371416635589039799264931055963184212634445020086079018041637872120622252063982557328706301303459005111074859708668835997235057986597464525071725304602188798550944801990636013252519592180544890697621702379736904364145383451567271794092434265575963952516814495552014866287925066146604111746132286427763366099070823701231960999082778900856942652714739992501100624268073848195130408142624493359360017288779100735632304697378993693601576392424237031046648841616256886280121701706041023472245110441454188767462151965881127445811201967515874877064214870561018342898886680723603512804423957958661604532164717074727811144463005730472495671982841383477589971334265380252551609901742339991267411205654591146919041221288459213564361584328551168311392854559188581406483969133373117149966787609216717601649280479945969390094007181209247350716203986286873969768059929898595956248809100121519588414840640974326745249183644870057788434433435314212588079846111647264757978488638496210002264248634494476470705896925955356647479826248519714590277208989687591332543300366441720682100553882572881423068040871240744529364994753285394698197549150941495409903556240249341963248712546706577092214891027691024216800435621574526763843189067614401328524418593207300356448205458231691845937301841732387286035331483808072488070914824903717258177064241497963997917653711488021270540044947468023613343312104170163349890
fib(x)
; this isfib(fib(x))
. \$\endgroup\$fib(fib(x))
function can be longer than building a new function, and the likely chance to re-use of some code elements could provide some new golfing opportunities. \$\endgroup\$