Is there some equivalence of MapIndexed for rules?
Consider a substitution on
3 a + 4 b + 21 c + ....
The first integer I want to replace by 1, the second integer by 4, and the i'th integer by i^2.
1 a + 4 b + 9 c + ....
How would you do that? I imagine some kind of indexed replacement would be useful.
Addition:I would like to use it to replace expressions like