included write to file codes for ordered and unordered permutation