private AckResult Ackermann(BigInteger m, BigInteger n, BackgroundWorker bckg_work, DoWorkEventArgs e)
        {
            var stack = new OverflowlessStack <BigInteger>();

            stack.Push(m);
            while (!stack.IsEmpty)
            {
                m = stack.Pop();
skipStack:

                if (bckg_work.CancellationPending)
                {
                    e.Cancel = true;
                    stack    = new OverflowlessStack <BigInteger>();
                    GC.Collect();
                    break;
                }

                if (m == 0)
                {
                    n = n + 1;
                }
                else if (m == 1)
                {
                    n = n + 2;
                }
                else if (m == 2)
                {
                    n = n * 2 + 3;
                }
                else if (n == 0)
                {
                    --m;
                    n = 1;
                    goto skipStack;
                }
                else
                {
                    stack.Push(m - 1);
                    --n;
                    goto skipStack;
                }
            }

            return(new AckResult {
                result = n
            });
        }
    public static BigInteger Ackermann(BigInteger m, BigInteger n)
    {
        var stack = new OverflowlessStack <BigInteger>();

        stack.Push(m);
        while (!stack.IsEmpty)
        {
            m = stack.Pop();
skipStack:
            if (m == 0)
            {
                n = n + 1;
            }
            else if (m == 1)
            {
                n = n + 2;
            }
            else if (m == 2)
            {
                n = n * 2 + 3;
            }
            else if (n == 0)
            {
                --m;
                n = 1;
                goto skipStack;
            }
            else
            {
                stack.Push(m - 1);
                --n;
                goto skipStack;
            }
        }
        return(n);
    }