Each number in the sequence has two possible successors, so if we just look at what values can succeed each other without regard to their position in the sequence, n, we get a binary tree. However, since n can only be prime when it is congruent to +/-1 mod 6, some otherwise potential successors can never be reached. The transition from single digits, to double digits always occurs with a(n)=11, and n can either be congruent to -1 or 1 mod 6, so we get the following two trees, shown below and continuing until the branches transition either to 3 digits or back to 1 digit... n mod 6 ----------------------------------------- 1 11 2 21 3 22 4 42_______________________ 5* 44 34 0 54___________ 53______ 1* 55 95 45 95 2 65 69 64 69 3 66 [7] 56 [7] 4 86______ 75___________ 5* 78 98 67 97 0 [8] 99__________ 86______ 89______ 1* [1] [101] 78 98 [9] 79 2 [8] 99 [8] 3 [1] n mod 6 ----------------------------------------- 5 11 0 21__________________________ 1* 22 32 2 42 33 3 44 43 4 54____________ 44__________________ 5* 55 95 54 74 0 65______ 69_______ 55______ 57____________ 1* 66 76 [7] 17 65 95 85 95 2 86 77 81 66 69 68 69 3 78 87 28 86 [7] 96 [7] 4 [8] 88______ [3] 78______ 89______ 5* [9] 98 [8] 97 [9] 79 0 99________ 89______ [8] 1* [1] [101] [9] 79 2 [8] Both of these trees can transition to 101, but 101 always occurs when n is congruent to 1 mod 6, so we only get 1 tree of three digits numbers for 101. n mod 6 ----------------------------------------- 1 101 2 201 3 202 4 302_______________ 5* 303 703 0 403_______ 407_______ 1* 404 904 804 904 2 504 509 508 509 3 505 [15] [15] [15] 4 605_______________ 5* 606 706 0 806_______ 707_______ 1* 708 908 807 907 2 [17] 909 808 809 3 [19] [18] [18] Now we are left with four cases for transitioning back to 2 digits from 3 digits... 18 and 19 will immediately transition all the way back to 1 digit, as the next position will be congruent to 4 mod 6, and the in both cases, the next composite is 20, which backwards is 2. 17 gives us the tree... n mod 6 ----------------------------------------- 2 17 3 81 4 28______ 5* [3] 92 0 39______ 1* [4] 14 2 51 3 25 4 62____________ 5* 36 76 0 83______ 77______ 1* 48 98 87 97 2 94 99 88 89 3 59 [1] [9] [9] 4 [6] and 15 gives us... n mod 6 ----------------------------------------- 3 15 4 61___________________ 5* 26 76 0 72______ 77______ 1* 47 37 87 97 2 84 83 88 89 3 58 48 [9] [9] 4 [6] 94______ 5* 59 79 0 [6] [8] Therefore the transitions into 3 digit are always followed very soon by transitions back to 2 digits and soon after back to 1 digit. Thus the highest number reachable is 909, which appears in the tree shown above for 101.