You needed to use the brackets () around $acc -1 like show to have this evaluate prior to 1 being added; math in brackets always is given presidence over non bracketed parts of an equation. Of course the regular presidence of math also occurs in the multiplication is done prior to division which is done prior to addition which is done prior to subtraction.

You don’t need the if($i >= 0) as in your for loop you always set it to 1;

Of course the regular presidence of math also occurs in the multiplication is done prior to division which is done prior to addition which is done prior to subtraction.

I did not understand the explanation, but you’ve got what I want . Thank you very much sir steve! I’ll just do more experiment to understand this code. Thank you!