A307613 Inverse of the permutation A307485: one odd, two even, four odd, eight even, etc; extended with a(0) = 0.
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
Keywords
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
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]))
Comments