login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Inverse of the permutation A307485: one odd, two even, four odd, eight even, etc; extended with a(0) = 0.
2

%I #15 Jul 29 2019 12:29:24

%S 0,1,2,4,3,5,8,6,9,7,10,16,11,17,12,18,13,19,14,20,15,21,32,22,33,23,

%T 34,24,35,25,36,26,37,27,38,28,39,29,40,30,41,31,42,64,43,65,44,66,45,

%U 67,46,68,47,69,48,70,49,71,50,72,51,73,52,74,53,75,54,76,55,77

%N Inverse of the permutation A307485: one odd, two even, four odd, eight even, etc; extended with a(0) = 0.

%C See A307485 for further information, motivation & references.

%C Also, a(n) is the smallest k not yet in the sequence such that bitxor(k,a(n-1)) >= a(n-1). - _Giorgos Kalogeropoulos_, May 31 2019

%H <a href="/index/Per#IntegerPermutation">OEIS' Index to sequences related to permutations of the integers</a>.

%e Index n : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...

%e A307485(n): 0, 1, 2, 4, 3, 5, 7, 9, 6, 8, ...

%e This sequence, the inverse permutation, is obtained by reading the above "from bottom to top", i.e., find the index in 2nd row, return the number above it: e.g., a(3) = 4, a(4) = 3, a(5) = 5, a(6) = 8, a(7) = 6, etc.

%t a[1]=1; a[n_] := a[n] = (t=1; While[BitXor[a[n-1],t] < a[n-1] || MemberQ[Array[a, n-1], t], t++]; t)

%t Join[{0}, Table[a[k], {k,100}]] (* _Giorgos Kalogeropoulos_, May 31 2019 *)

%o (PARI) my(A=apply(A307485,[1..99]), B=vecsort(A,,1)); for(i=1,#B,A[B[i]]==i||return(A307613=B[1..i-1]))

%Y Cf. A307485 (inverse permutation), A307612 (partial sums thereof).

%Y Cf. A103889 (odd & even swapped), A004442 (pairs reversed: n + (-1)^n).

%Y Odd numbers: A005408. Even numbers: A005843.

%Y Cf. A233275 (different permutation based on entangling odd & even numbers).

%K nonn

%O 0,3

%A _M. F. Hasler_, Apr 18 2019