%I #30 May 14 2019 11:18:18
%S 1,3,5,7,9,13,11,15,17,25,21,29,19,27,23,31,33,49,41,57,37,53,45,61,
%T 35,51,43,59,39,55,47,63,65,97,81,113,73,105,89,121,69,101,85,117,77,
%U 109,93,125,67,99,83,115,75,107,91,123,71,103,87,119,79,111,95,127,129,193
%N Convert 2n-1 to binary. Reverse its digits. Convert back to decimal to get a(n).
%C This sequence is a permutation of the odd positive integers.
%C From _Yosu Yurramendi_, Feb 05 2019: (Start)
%C If the terms (n > 0) are written as an array (left-aligned fashion) with rows of length 2^m, m = 0,1,2,3,...
%C 1,
%C 3, 5,
%C 7, 9, 13, 11,
%C 15, 17, 25, 21, 29, 19, 27, 23,
%C 31, 33, 49, 41, 57, 37, 53, 45, 61, 35, 51, 43, 59, 39, 55, 47,
%C 63, 65, 97, 81, 113, 73, 105, 89, 121, 69, 101, 85, 117, 77, 109, 93, 125, ...
%C for m > 0, a(2^(m+1)) = 2*a(2^m) + 1; a(2^m + 1) = a(2^m) + 2; a(2^(m+1) + 2^m) = 2*a(2^(m+1)) - 1,
%C for m > 0, 0 < k < 2^m, a(2^(m+1) + k) = 2*a(2^m + k) - 1, a(2^(m+1) + 2^m + k) = a(2^(m+1) + k) + 2.
%C This relationship is enough to reproduce the sequence.
%C If the terms (n > 0) are written as an array (right-aligned fashion):
%C 1,
%C 3, 5,
%C 7, 9, 13, 11,
%C 15, 17, 25, 21, 29, 19, 27, 23,
%C 31, 33, 49, 41, 57, 37, 53, 45, 61, 35, 51, 43, 59, 39, 55, 47,
%C ... 93, 125, 67, 99, 83, 115, 75, 107, 91, 123, 71, 103, 87, 119, 79, 111, 95,
%C ...
%C for m >= 0, a(2^(m+1)+2^m) = 4*a(2^m) + 1.
%C for m >= 0, 0 <= k < 2^m-1, a(2^(m+2)-1-k) = 2*a(2^(m+1)-1-k) + 1.
%C (End)
%H Antti Karttunen, <a href="/A145341/b145341.txt">Table of n, a(n) for n = 1..16384</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = A030101(2n-1).
%F a(n) = A145342(n)*2 - 1.
%t Table[FromDigits[Reverse[IntegerDigits[2*n - 1, 2]], 2], {n, 1, 100}] (* _Stefan Steinerberger_, Oct 11 2008 *)
%o (R)
%o nmax <- 10^3 # by choice
%o a <- vector()
%o for (o in seq(1,nmax,2)){
%o w <- which(as.numeric(intToBits(o))==1)
%o a <- c(a, sum(2^(max(w)-w)))
%o }
%o a[1:66]
%o # _Yosu Yurramendi_, Feb 04 2019
%o (PARI) a(n) = fromdigits(Vecrev(binary(2*n-1)), 2); \\ _Michel Marcus_, Feb 04 2019
%Y Cf. A030101, A145342.
%K base,nonn
%O 1,2
%A _Leroy Quet_, Oct 08 2008
%E More terms from _R. J. Mathar_, _Ray Chandler_ and _Stefan Steinerberger_, Oct 10 2008