(50G) Perfect Permutation Producer - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (50G) Perfect Permutation Producer (/thread-3996.html) |
(50G) Perfect Permutation Producer - Gerald H - 05-27-2015 01:53 PM Given a prime positive integer P & a positive integer input the programme produces a perfect permutation of the positive integers < P. A perfect permutation consists of integers where the difference between neighbours is not repeated. eg For input 107 45 the programme returns { 1 45 99 68 64 98 23 72 30 66 81 7 101 51 48 20 44 54 76 103 34 32 49 65 36 15 33 94 57 104 79 24 10 22 27 38 105 17 16 78 86 18 61 70 47 82 52 93 12 5 11 67 19 106 62 8 39 43 9 84 35 77 41 26 100 6 56 59 87 63 53 31 4 73 75 58 42 71 92 74 13 50 3 28 83 97 85 80 69 2 90 91 29 21 89 46 37 60 25 55 14 95 102 96 40 88 } Code:
|