OFFSET
1,2
LINKS
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