cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A145341 Convert 2n-1 to binary. Reverse its digits. Convert back to decimal to get a(n).

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