Little Ackermann implementation