public static double summ(double n) { double result = 0; for (int i = 1; i <= (int)n; i++) { result = result + (1.0 / i); } return result; } public static void main(String[] args) { double n = 10.0; System.out.println(summ(Math.pow(n, 6))); System.out.println(summ(Math.pow(n, 8))); }