login
Reverse the order of inner digits (all digits but the first and last) of n written in binary. a(n) = the decimal value of the result.
1

%I #18 Jan 14 2023 17:21:53

%S 1,2,3,4,5,6,7,8,9,12,13,10,11,14,15,16,17,24,25,20,21,28,29,18,19,26,

%T 27,22,23,30,31,32,33,48,49,40,41,56,57,36,37,52,53,44,45,60,61,34,35,

%U 50,51,42,43,58,59,38,39,54,55,46,47,62,63,64,65,96,97,80,81,112,113,72

%N Reverse the order of inner digits (all digits but the first and last) of n written in binary. a(n) = the decimal value of the result.

%C This is a self-inverse permutation of the positive integers.

%H John Tyler Rascoe, <a href="/A163807/b163807.txt">Table of n, a(n) for n = 1..10000</a>

%e 18 in binary is 10010. The inner digits are 001. Reverse these, leaving the first digit (a 1) and the last digit (a 0) untouched, and we have 11000. a(18) is the decimal equivalent of 11000, which is 24.

%t a[n_]:=FromDigits[Append[Join[{Part[IntegerDigits[n,2],1]},Reverse[Drop[Drop[IntegerDigits[n,2],1],-1]]],Part[IntegerDigits[n,2],-1]],2]; Join[{1},Array[a,71,2]] (* _Stefano Spezia_, Jan 14 2023 *)

%Y Cf. A030101.

%K base,nonn,look

%O 1,2

%A _Leroy Quet_, Aug 04 2009

%E More terms from _R. J. Mathar_, Sep 27 2009