L-algorithm of next permutation