Hello,
I'm extensively using recursive function definitions and need to compute the first 0..N terms of them, for example
a(n)=if(n<2,1,a(n-1)+a(n-2))
for(n=0,100,print(a(n)))
The computation is very slow because PARI/GP apparently does not re-use previously computed terms.
I found the following GP script which implements a cache:
However, I was wondering if there is any built-in support for caching (recursive) function values?
An alternative could be to calculate recursive function terms incrementally. Is there any syntax/pattern in GP available for this?
Cheers,
Christian