Sudan function: Difference between revisions
Content added Content deleted
(Added Wren) |
(Corrected JS implementation) |
||
Line 63: | Line 63: | ||
*/ |
*/ |
||
function F(n, x, y) { |
function F(n, x, y) { |
||
if (n === |
if (n === 0) { |
||
return x + y; |
return x + y; |
||
} |
} |
||
if (y === |
if (y === 0) { |
||
return x; |
return x; |
||
} |
} |
||
return F(n - |
return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y); |
||
} |
} |
||
</lang> |
</lang> |