public class Brain {
static int range;
double calculate() {
double sum = 0;
for (int n = 1; n <= Brain.range; n++) {
sum = sum + (double) (1 / n);
}
return sum;
}
}
我总是得到1.0的回报。我试着在这里理解它,但没有帮助:Harmonic sequence recursion