an+1=(an+gn)/2,