Example of recursive define in real system/ programs

278 views Asked by At

I'm working on a solver to solve the recursive constraint. How the solver works is like that, for example given a sequence which is recursively defined as a(n) = a(n-1)*2 + 2. then the solver will find the exactly formula representing the a(n) based on n. You can look at this example in wolfram alpha for more understanding

In programming. the program which computes the sequence is likes this:

 a[0] = 1;
    for (i = 1; i <= n; i = i+1)
        a[i] = 2*a[i-1]+2;

Then by using our solver, I can represent a[n] by n and add this feature to constraint. However, I'm sort of finding the real world examples which includes the recursive sequences or linear recurrence relation like this. Do you know any piece of code which can be my test bench?

0

There are 0 answers