Update permutations

this recursive version can pass the tests