cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Apr 18 2019

Keywords

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

Examples

			  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.
		

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).

Programs

  • 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 *)
  • 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]))