OFFSET
1,2
COMMENTS
LINKS
FORMULA
a(n) = n - 3*A053645(A002265(n)) + (2^(A000523(n)-2)-1)*A010873(n) for n >= 4. - Robert Israel, Sep 01 2015
EXAMPLE
a(20)=a('10100')='10001'=17; a(25)=a('11001')='10110'=22.
MAPLE
f:= proc(n) local m, a;
m:= ilog2(n);
a:= n mod 4;
(n - a - 2^m)/4 + 2^(m-2)*a+2^m
end proc:
f(2):= 2:
map(f, [$1..100]); # Robert Israel, Sep 01 2015
MATHEMATICA
Table[FromDigits[Prepend[RotateRight[Rest[IntegerDigits[n, 2]], 2], 1], 2], {n, 72}] (* Ivan Neretin, Aug 30 2015 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Feb 20 2003
STATUS
approved