Skip to main content
2 of 5
deleted 61 characters in body
garej
  • 5k
  • 2
  • 20
  • 44

Another approach is to replace n's with respective index.

s = Nest[1 + x^n (#) &, 1, 3] 

enter image description here

z = 1 + x^n (1 + x^n (1 + x^n)) 

Use ReplacePart with Map(/@)

ReplacePart[z, Position[z, n][[#]] -> Defer@# & /@ Range[3]] 

enter image description here

If you do not want x^1 drop Defer.

garej
  • 5k
  • 2
  • 20
  • 44