I am studying recursion now, I stumbled upon a problem, I can’t solve it for a long time.
X = 1 + 1/2 + 1 / (2 * 3) + 1 / (2 * 3 * 4) + 1 / (2 * 3 * 4 * 5) .....
How to solve this without conditional operators and preferably recursion?
I tried this code, but it does not work correctly.
public static double test1 (double n) {if (n == 1) return 1; return (1.0 / (n * test1 (n - 1))) + test1 (n - 1); }