Is this what you're lookingThis may not be ideal or the most elegant, but perhaps it will work or help.
Define (note that int can be whatever range you want):
In[3]:= a[0] = 0; int = Range[4]; Create a list of symbols for? your LHS:
In[1]In[3]:= NestList[f[1lhs = a[#] & /@ int Out[3]= {a[1], a[2], a[3], a[4]} This gives us your RHS's, primarily just mapping a expr /. rule expression across the iterators {1,2,3,4}:
In[4]:= vals = (Sqrt[s[# - 1]^2 + #]s[# - 1] + 1] /. s[# - 1] -> FoldList[#1 + a[#2] &, 0int - 1][[#]]) & /@ int Out[4]= {1, 4]Sqrt[1 + a[1] + a[1]^2], Sqrt[ 1 + a[1] + a[2] + (a[1] + a[2])^2], Sqrt[ Out[1]= 1 + a[1] + a[2] + a[3] + (a[1] + a[2] + a[3])^2]} And you can thread Set across them to get your end result:
In[5]:= Thread@Set[Evaluate[lhs], vals] Out[5]= {01, f[1]Sqrt[3], f[1Sqrt[2 + f[1]]Sqrt[3] + (1 + Sqrt[3])^2], f[1Sqrt[ 2 + f[1Sqrt[3] + f[1]]]Sqrt[ 2 + Sqrt[3] + (1 + Sqrt[3])^2] + (1 + Sqrt[3] + Sqrt[ 2 + Sqrt[3] + (1 + Sqrt[3])^2])^2]} To verify this...
In[6]:= {a[1], a[2], a[3], a[4]} Out[6]= f[1{1, Sqrt[3], Sqrt[2 + f[1Sqrt[3] + f[1(1 + f[1]]]]Sqrt[3])^2], Sqrt[ 2 + Sqrt[3] + Sqrt[ 2 + Sqrt[3] + (1 + Sqrt[3])^2] + (1 + Sqrt[3] + Sqrt[ 2 + Sqrt[3] + (1 + Sqrt[3])^2])^2]} Like I said, you can let int be as high as you want to define as many values of a[n] are necessary. This isn't recursive, but it would work. Hoping someone can provide a better solution :)