Question: Color recursive inert formula

I have a recursive function that spits out recursive formulates "evaluated inertly" so bascially it produces a formula simply like a symbolic formula(doesn't reduce the addition of values though).

 

What I would like is to color code each recursive step

e.g.,

F := proc(n)
    local i,k:
    if n <= 0 then return 1; end if:
    F(n-2) %+ F(n-1):
end proc:

F(5);

value(F(5));
 

so I would like to cover each part of the recursion differently so it is easier to see, maybe even use the previous colors so one can visualize the nestings of the recursion. (e.g., F(n-2) takes the previous formals color and tweaks it towards the red and and F(n-1) takes the porevious formulas color and tweaks it towards green)
(this would then pass an RGB value that(default, say blue) to the functions above).

 

Any way to accomplish this?

 

 

 

 

Please Wait...