13 lines
292 B
Java
13 lines
292 B
Java
|
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));
|
||
|
}
|
||
|
}
|