Alexander Bogomolyn's unordered permutation algorithm