login
A307613
Inverse of the permutation A307485: one odd, two even, four odd, eight even, etc; extended with a(0) = 0.
2
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, 34, 24, 35, 25, 36, 26, 37, 27, 38, 28, 39, 29, 40, 30, 41, 31, 42, 64, 43, 65, 44, 66, 45, 67, 46, 68, 47, 69, 48, 70, 49, 71, 50, 72, 51, 73, 52, 74, 53, 75, 54, 76, 55, 77
OFFSET
0,3
COMMENTS
See A307485 for further information, motivation & references.
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
EXAMPLE
Index n : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
A307485(n): 0, 1, 2, 4, 3, 5, 7, 9, 6, 8, ...
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.
MATHEMATICA
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)
Join[{0}, Table[a[k], {k, 100}]] (* Giorgos Kalogeropoulos, May 31 2019 *)
PROG
(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]))
CROSSREFS
Cf. A307485 (inverse permutation), A307612 (partial sums thereof).
Cf. A103889 (odd & even swapped), A004442 (pairs reversed: n + (-1)^n).
Odd numbers: A005408. Even numbers: A005843.
Cf. A233275 (different permutation based on entangling odd & even numbers).
Sequence in context: A104472 A316964 A187790 * A279343 A222599 A249683
KEYWORD
nonn
AUTHOR
M. F. Hasler, Apr 18 2019
STATUS
approved