Find the power to x nearest to arr [ i ]
if abs ( x ** k - arr [ i ] ) < abs ( x ** ( k + 1 ) - arr [ i ] ) : NEW_LINE INDENT arr [ i ] = x ** k NEW_LINE DEDENT else : NEW_LINE INDENT arr [ i ] = x ** ( k + 1 ) NEW_LINE DEDENT