permutation sequence reimpl