3 ms·
I took the Ackermann function [1] from Rosetta Code [2]: function ack(m: number, n: number): number { return m === 0 ? n + 1 : ack(m - 1, n === 0 ?
by bArray 3y ago
I took the Ackermann function [1] from Rosetta Code [2]:
function ack(m: number, n: number): number {
return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1));
}
I tried `ack(m = 2, n = 2)` but the recursion depth prevented (3, 2) or (2, 3).
[1] https://en.wikipedia.org/wiki/Ackermann_function https://en.wikipedia.org/wiki/Ackermann_function
[2] https://rosettacode.org/wiki/Ackermann_function#JavaScript https://rosettacode.org/wiki/Ackermann_function#JavaScript