login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(0)=0; a(2n) = unlucky(a(n)), a(2n+1) = lucky(a(n)+1), where lucky = A000959, unlucky = A050505.
10

%I #25 Sep 13 2015 05:10:41

%S 0,1,2,3,4,7,5,9,6,13,11,25,8,15,14,33,10,21,19,51,17,43,35,115,12,31,

%T 22,67,20,63,45,163,16,37,29,93,27,79,66,273,24,73,57,223,47,171,146,

%U 723,18,49,42,151,30,99,88,385,28,87,83,349,59,235,203,1093,23,69,50,193,40,135,119,559,38,129,102,475,86,367,335,1983,34,111

%N a(0)=0; a(2n) = unlucky(a(n)), a(2n+1) = lucky(a(n)+1), where lucky = A000959, unlucky = A050505.

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

%C 0

%C |

%C ...................1...................

%C 2 3

%C 4......../ \........7 5......../ \........9

%C / \ / \ / \ / \

%C / \ / \ / \ / \

%C / \ / \ / \ / \

%C 6 13 11 25 8 15 14 33

%C 10 21 19 51 17 43 35 115 12 31 22 67 20 63 45 163

%C etc.

%C Because all lucky numbers are odd, it means that even terms can only occur in even positions (together with odd unlucky numbers, for each one of which there is a separate infinite cycle), while terms in odd positions are all odd.

%H Antti Karttunen, <a href="/A257726/b257726.txt">Table of n, a(n) for n = 0..512</a>

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

%F a(0)=0; after which, a(2n) = A050505(a(n)), a(2n+1) = A000959(a(n)+1).

%F As a composition of other permutations. For all n >= 1:

%F a(n) = A257731(A246378(n)).

%F a(n) = A257733(A237126(n)).

%F a(n) = A257801(A257728(n)).

%o (Scheme, with memoizing definec-macro)

%o (definec (A257726 n) (cond ((zero? n) n) ((even? n) (A050505 (A257726 (/ n 2)))) (else (A000959 (+ 1 (A257726 (/ (- n 1) 2)))))))

%Y Inverse: A257725.

%Y Cf. A000959, A050505, A005408, A005843.

%Y Related or similar permutations: A237126, A246378, A257728, A257731, A257733, A257801.

%Y Cf. also A183089 (another similar permutation, but with a slightly different definition, resulting the first differing term at n=9, where a(9) = 13, while A183089(9) = 21).

%Y Cf. also A257735 - A257738.

%K nonn,tabf

%O 0,3

%A _Antti Karttunen_, May 06 2015