17 June 2012 11:39:41 AM UNICYCLE_PRB C++ version Test the UNICYCLE library. TEST01 PERM_IS_UNICYCLE determines whether a permutation is a unicyle This permutation is a unicycle 1 2 3 4 5 2 5 1 3 4 The permutation in sequence form 1 2 5 4 3 This permutation is NOT a unicycle 1 2 3 4 5 3 2 1 4 5 This permutation is NOT a unicycle 1 2 3 4 5 1 4 3 2 5 This permutation is NOT a unicycle 1 2 3 4 5 3 5 2 4 1 This permutation is NOT a unicycle 1 2 3 4 5 5 3 2 4 1 This permutation is NOT a unicycle 1 2 3 4 5 5 1 3 4 2 This permutation is NOT a unicycle 1 2 3 4 5 2 5 3 4 1 This permutation is a unicycle 1 2 3 4 5 5 3 1 2 4 The permutation in sequence form 1 5 4 2 3 This permutation is a unicycle 1 2 3 4 5 5 3 1 2 4 The permutation in sequence form 1 5 4 2 3 This permutation is NOT a unicycle 1 2 3 4 5 1 5 4 3 2 TEST02 UNICYCLE_ENUM enumerates the unicycles of N objects. N Number 0 1 1 1 2 1 3 2 4 6 5 24 6 120 7 720 8 5040 9 40320 10 362880 TEST03 UNICYCLE_INVERSE inverts a unicycle; The original unicycle: 1 7 6 2 4 3 5 The inverse unicycle: 1 5 3 4 2 6 7 TEST04 UNICYCLE_NEXT generates unicycles in lex order. 0: 1 2 3 4 5 1: 1 2 3 5 4 2: 1 2 4 3 5 3: 1 2 4 5 3 4: 1 2 5 3 4 5: 1 2 5 4 3 6: 1 3 2 4 5 7: 1 3 2 5 4 8: 1 3 4 2 5 9: 1 3 4 5 2 10: 1 3 5 2 4 11: 1 3 5 4 2 12: 1 4 2 3 5 13: 1 4 2 5 3 14: 1 4 3 2 5 15: 1 4 3 5 2 16: 1 4 5 2 3 17: 1 4 5 3 2 18: 1 5 2 3 4 19: 1 5 2 4 3 20: 1 5 3 2 4 21: 1 5 3 4 2 22: 1 5 4 2 3 23: 1 5 4 3 2 TEST05 UNICYCLE_RANDOM produces a random unicyle For this test, N = 5 1 2 5 3 4 1 3 2 4 5 1 2 4 3 5 1 3 5 2 4 1 5 4 3 2 TEST06 UNICYCLE_RANK ranks a unicycle. The unicycle: 1 5 2 3 4 The rank is: 18 TEST07 UNICYCLE_UNRANK, given a rank, computes the corresponding unicycle. The requested rank is 6 The unicycle: 1 3 2 4 5 TEST08 UNICYCLE_INDEX converts a unicycle to index form. UNICYCLE_INDEX_TO_SEQUENCE converts an index to unicycle form. The unicycle: 1 3 6 2 4 5 The index form: 1 2 3 4 5 6 3 4 6 5 1 2 The unicycle recovered: 1 3 6 2 4 5 The unicycle: 1 2 4 3 5 6 The index form: 1 2 3 4 5 6 2 4 5 3 6 1 The unicycle recovered: 1 2 4 3 5 6 The unicycle: 1 2 4 5 6 3 The index form: 1 2 3 4 5 6 2 4 1 5 6 3 The unicycle recovered: 1 2 4 5 6 3 The unicycle: 1 2 6 5 4 3 The index form: 1 2 3 4 5 6 2 6 1 3 4 5 The unicycle recovered: 1 2 6 5 4 3 The unicycle: 1 6 2 4 5 3 The index form: 1 2 3 4 5 6 6 4 1 5 3 2 The unicycle recovered: 1 6 2 4 5 3 UNICYCLE_PRB Normal end of execution. 17 June 2012 11:39:41 AM