A354901 a(n) = (b(2n) - 1)/2 - n for n > 0. To get b(n) start with A = n and then for i = 0..f(n) apply A := A + 2^i*T(A, f(n) - i) where T(n, k) = floor(n/2^k) mod 2 and f(n) = A000523(n).
1, 2, 3, 4, 6, 7, 5, 8, 12, 10, 14, 13, 11, 15, 9, 16, 24, 20, 28, 22, 30, 18, 26, 25, 21, 29, 23, 31, 19, 27, 17, 32, 48, 40, 56, 36, 52, 44, 60, 42, 58, 38, 54, 46, 62, 34, 50, 49, 41, 57, 37, 53, 45, 61, 43, 59, 39, 55, 47, 63, 35, 51, 33, 64, 96, 80, 112
Offset: 1
Keywords
Links
- Peter J. Taylor, Permutation of the natural numbers from operation related to binary expansion of n, answer to question on MathOverflow (2023).
- Index entries for sequences that are permutations of the natural numbers
- Index entries for sequences related to binary expansion of n
Programs
-
PARI
b(n)=my(L=logint(n,2),A=n); for(i=0,L, A+=2^i*bittest(A,L-i)); A; a(n)=(b(2*n) - 1)/2 - n
Comments