10 April 2020 10:10:54 AM UNICYCLE_TEST C++ version Test the UNICYCLE library. PERM_IS_UNICYCLE_TEST 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 UNICYCLE_ENUM_TEST 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 UNICYCLE_INDEX_TEST UNICYCLE_INDEX converts a unicycle to index 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_INDEX_TO_SEQUENCE_TEST 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_INVERSE_TEST 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 UNICYCLE_NEXT_TEST 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 UNICYCLE_RANDOM_TEST 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 UNICYCLE_RANK_TEST UNICYCLE_RANK ranks a unicycle. The unicycle: 1 5 2 3 4 The rank is: 18 UNICYCLE_UNRANK_TEST UNICYCLE_UNRANK, given a rank, computes the corresponding unicycle. The requested rank is 6 The unicycle: 1 3 2 4 5 UNICYCLE_TEST Normal end of execution. 10 April 2020 10:10:54 AM