login
A316472
Inverse permutation to A316385.
2
1, 3, 2, 5, 7, 6, 4, 9, 11, 13, 15, 10, 14, 12, 8, 17, 19, 21, 23, 25, 27, 29, 31, 18, 22, 26, 30, 20, 28, 24, 16, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 34, 38, 42, 46, 50, 54, 58, 62, 36, 44, 52, 60, 40, 56, 48, 32, 65, 67, 69, 71
OFFSET
1,2
FORMULA
a(n) = (2*b(n) + 1)*2^(L(n) - L(b(n)) - 1) where b(n) = A053645(A153142(n)) and where L(n) = A000523(n) for n > 0 with L(0) = -1. - Mikhail Kurkov, Sep 09 2023 [verification needed]
EXAMPLE
A316385(42) = 50 hence a(50) = 42.
PROG
(PARI) b1(n) = my(b=binary(n)); fromdigits(concat(b[1], Vecrev(vector(#b-1, k, b[k+1]))), 2); \\ A059893
b2(n) = if(n < 2, n, if((n + 1) == 2^logint(n + 1, 2), (n + 1) / 2, n + 1)) \\ A153152
a(n) = my(A = 2^logint(n, 2), B = b1(b2(b1(n))) - A); (2 * B + 1) * A / 2 ^ (if(B == 0, -1, logint(B, 2)) + 1) \\ Mikhail Kurkov, Sep 09 2023 [verification needed]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 04 2018
STATUS
approved