How to update a range of a segment tree from indices i to j when the values added are in an Arithmetic Progression?

I want to solve a problem which asks to update a range from indices i to j with value p as…
A[i]+=p;
A[i+1]+=2*p;
… and so on till jth index.
How can I do it using a segment tree?

1 Like