modified lc permutations (use a boolean vector to record the visited
index)