login
Permutation of natural numbers: a(0) = 1, a(1) = 2, a(2n) = A005117(1+a(n)), a(2n+1) = A065642(a(n)).
5

%I #8 Apr 17 2017 09:02:31

%S 1,2,3,4,5,9,6,8,7,25,14,27,10,12,13,16,11,49,39,125,22,28,42,81,15,

%T 20,19,18,21,169,26,32,17,121,79,343,65,117,205,625,35,44,43,56,69,84,

%U 133,243,23,45,33,40,31,361,30,24,34,63,277,2197,41,52,53,64,29,289,199,1331,130,6241,563,2401,106,325,193,351,335,1025,1030,3125,58

%N Permutation of natural numbers: a(0) = 1, a(1) = 2, a(2n) = A005117(1+a(n)), a(2n+1) = A065642(a(n)).

%C Note the indexing: the domain starts from 0, while the range excludes zero.

%C This sequence can be represented as a binary tree. Each left hand child is produced as A005117(1+n), and each right hand child as A065642(n), when the parent node contains n >= 2:

%C 1

%C |

%C ...................2...................

%C 3 4

%C 5......../ \........9 6......../ \........8

%C / \ / \ / \ / \

%C / \ / \ / \ / \

%C / \ / \ / \ / \

%C 7 25 14 27 10 12 13 16

%C 11 49 39 125 22 28 42 81 15 20 19 18 21 169 26 32

%C etc.

%H Antti Karttunen, <a href="/A285112/b285112.txt">Table of n, a(n) for n = 0..116</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(0) = 1, a(1) = 2, a(2n) = A005117(1+a(n)), a(2n+1) = A065642(a(n)).

%o (Scheme, with memoization-macro definec)

%o (definec (A285112 n) (cond ((<= n 1) (+ n 1)) ((even? n) (A005117 (+ 1 (A285112 (/ n 2))))) (else (A065642 (A285112 (/ (- n 1) 2))))))

%Y Inverse: A285111.

%Y Cf. A005117, A065642.

%Y Similar or related permutations: A243344, A243346, A252753, A277696, A284572.

%Y Cf. also arrays A284457 & A284311.

%K nonn,tabf

%O 0,2

%A _Antti Karttunen_, Apr 17 2017