%I #16 May 24 2015 13:38:23
%S 1,2,3,4,6,5,10,7,15,9,28,8,21,14,66,11,36,20,136,13,55,35,435,12,45,
%T 27,253,19,120,77,2278,16,78,44,703,26,231,152,9453,18,105,65,1596,43,
%U 666,464,95266,17,91,54,1081,34,406,275,32385,25,210,135,7381,89,3081,2345,2598060,22,153,90,3160,53,1035,740,248160,33
%N Permutation of natural numbers: a(1) = 1; a(2n) = nontriangular(a(n)), a(2n+1) = triangular(1+a(n)), where triangular = A000217, nontriangular = A014132.
%C This sequence can be represented as a binary tree. Each left hand child is produced as A014132(n) and each right hand child as A000217(1+n), when a parent contains n >= 1:
%C 1
%C ................../ \..................
%C 2 3
%C 4......../ \........6 5......../ \.......10
%C / \ / \ / \ / \
%C / \ / \ / \ / \
%C / \ / \ / \ / \
%C 7 15 9 28 8 21 14 66
%C 11 36 20 136 13 55 35 435 12 45 27 253 19 120 77 2278
%C etc.
%H Antti Karttunen, <a href="/A257798/b257798.txt">Table of n, a(n) for n = 1..1024</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(1)=1; after which: a(2n) = A014132(a(n)), a(2n+1) = A000217(a(n)+1).
%o (Scheme, with memoizing definec-macro)
%o (definec (A257798 n) (cond ((<= n 1) n) ((even? n) (A014132 (A257798 (/ n 2)))) (else (A000217 (+ 1 (A257798 (/ (- n 1) 2)))))))
%Y Inverse: A257797.
%Y Cf. A000217, A014132.
%Y Cf. also permutation A183079.
%K nonn
%O 1,2
%A _Antti Karttunen_, May 18 2015
|