Блог пользователя Hexagons

Автор Hexagons, 3 года назад, По-английски

Define a function $$$s(n)$$$ (where $$$n$$$ is an integer) which returns the successor of the integer $$$n$$$

Define another function $$$f(a,b,k)$$$ such that $$${a,b,k}$$$ belong to integers, $$$f(a,b,0)$$$ = $$$s(s(s(.....s(s(a))......)))$$$ (call function $$$f$$$ on $$$a$$$ for $$$b$$$ times), and $$$f(a,b,k)$$$ = $$$f(a,f(a,f(a,.......f(a,f(a,b,k-1),k-1),k-1),......),k-1)$$$ (call function f such that the second parameter b is this function nested b-1 times and the third parameter is k-1)

It can be shown that $$$f(a,b,0)$$$ = $$$a+b$$$, $$$f(a,b,1)$$$ = $$$a*b$$$, $$$f(a,b,2)$$$ = $$$a^b$$$, and $$$f(a,b,3)$$$ = $$$a↑↑b$$$ (Tetration symbol)

Any thoughts about this function and the best different complexities to calculate it in terms of $$$a,b,k$$$ in preprocessing and the call of this function?

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится