mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
14b67bc0ff
- ackermann(3, 1) - ackermann(3, 2) - fibonacci(10) - fibonacci(16) Contract code included: PerformanceTester.sol
17 lines
362 B
Solidity
17 lines
362 B
Solidity
contract PerformanceTester {
|
|
function ackermann(uint m, uint n) returns (uint) {
|
|
if (m == 0)
|
|
return n + 1;
|
|
|
|
if (n == 0)
|
|
return ackermann(m - 1, 1);
|
|
|
|
return ackermann(m - 1, ackermann(m, n - 1));
|
|
}
|
|
|
|
function fibonacci(uint n) returns (uint) {
|
|
if (n == 0 || n == 1)
|
|
return n;
|
|
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
}
|
|
} |