GO Solution For UVa 371 - Ackermann Functions. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

An Ackermann function has the characteristic that the length of the sequence of numbers generated by the function cannot be computed directly from the input value. One particular integer Ackermann function is the following:

Xn+1 :=

{ Xn 2 if Xn is even 3Xn + 1 if Xn is odd

This Ackermann has the

...

You can find the full details of the problem Ackermann Functions at UVa Online Judge

Sample Input

  1 20
 35 55
  0 0

Sample Output

Between 1 and 20, 18 generates the longest sequence of 20 values.
Between 35 and 55, 54 generates the longest sequence of 112 values.

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985