1:term=1term = 1

2:y=0y = 0

3:for i=0i = 0 to nn do

4:y=y+aitermy = y + a_i \cdot term

5:term=termxterm = term \cdot x

6:end for