//n次方根牛迭 public static double nSqrt(int a, int n) { double v = a; double last = 0; do { last = v; // v = (Math.pow(v, n) * (n - 1) + a) / (n * Math.pow(v, n - 1)); v = ((n - 1) * v + (a / Math.pow(v, n - 1))) / n; } while (Math.abs(v - last) > 0.000001); return v; }