C System Outofmemoryexception When Generating Permutations Stack Overflow

C System Outofmemoryexception When Generating Permutations Stack Overflow