APL/DEV 3.2/TP04/Derecursivation/Recursif.java

13 lines
292 B
Java
Raw Permalink Normal View History

2022-10-26 11:13:11 +02:00
public class Recursif {
public static double f(double v) {
if (v == 0) return 0.0;
if (v == 1) return 1.0;
return v + f(Math.floor(v / 2)) - f(Math.floor(v / 3));
}
public static void main(String[] args) {
System.out.println(f(250));
}
}