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.

A162751 Write down in binary the n-th positive (odd) integer that is a palindrome in base 2. Take only the leftmost half of the digits (including the middle digit if there are an odd number of digits). a(n) is the decimal equivalent of the result.

This page as a plain text file.
%I A162751 #29 Apr 24 2024 09:38:39
%S A162751 1,1,2,3,2,3,4,5,6,7,4,5,6,7,8,9,10,11,12,13,14,15,8,9,10,11,12,13,14,
%T A162751 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,16,17,18,19,20,21,
%U A162751 22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44
%N A162751 Write down in binary the n-th positive (odd) integer that is a palindrome in base 2. Take only the leftmost half of the digits (including the middle digit if there are an odd number of digits). a(n) is the decimal equivalent of the result.
%C A162751 Every positive integer occurs exactly twice in this sequence.
%H A162751 Robert Israel, <a href="/A162751/b162751.txt">Table of n, a(n) for n = 1..10000</a>
%F A162751 a(1) = a(2) = 1; for i >= 2, a(2 i-1) = 2 a(i-1) and a(2 i) = 2 a(i-1) + 1.  _Robert Israel_, Apr 03 2014
%e A162751 27 is the 9th (odd) palindrome when written in binary. 27 in binary is 11011. Take the leftmost half of the digits (including the middle digit), and we have 110. a(9) is decimal equivalent of this, which is 6.
%p A162751 read("transforms3") ; a006995 := BFILETOLIST("b006995.txt") ; chop := proc(L) [op(1.. floor((nops(L)+1)/2),L)] ; end: for n from 2 to 100 do p := op(n,a006995) ; bdgs := chop(convert(p,base,2)) ; add(op(-i,bdgs)*2^(i-1),i=1..nops(bdgs)) ; printf("%d,",%) ; end do: # _R. J. Mathar_, Aug 01 2009
%p A162751 A162751:= proc(n) option remember;
%p A162751           if n <= 2 then 1
%p A162751           elif n::odd then 2*procname((n-1)/2)
%p A162751           else 2*procname(n/2-1)+1
%p A162751           end if
%p A162751 end proc;  # _Robert Israel_, Apr 03 2014
%t A162751 a[n_] := a[n] = If[n <= 2, 1, If[OddQ[n], 2 a[(n-1)/2], 2 a[n/2-1] + 1]];
%t A162751 Array[a, 75] (* _Jean-François Alcover_, Apr 06 2020, after _Robert Israel_ *)
%Y A162751 Cf. A006995.
%K A162751 base,nonn
%O A162751 1,3
%A A162751 _Leroy Quet_, Jul 12 2009
%E A162751 More terms from _R. J. Mathar_, Aug 01 2009