polinominal calculation using iteration