change base n to recursion