[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Positive integers whose base-2 run lengths form a palindrome.
6

%I #36 Apr 13 2021 23:19:05

%S 1,2,3,5,7,9,10,12,15,17,21,27,31,33,38,42,45,51,52,56,63,65,73,85,93,

%T 99,107,119,127,129,142,150,153,165,170,178,189,195,204,212,219,231,

%U 232,240,255,257,273,297,313,325,341,365,381

%N Positive integers whose base-2 run lengths form a palindrome.

%C This sequence exactly contains those positive integers in A006995 (positive binary palindromes) together with the terms of A035928 (those positive integers n where reversing the order of the binary digits produces the binary complement of n). - _Leroy Quet_, Sep 14 2009

%C Also the indices of the compositions that are palindromic. For the definition of the index of a composition see A298644. For example, 93 is in the sequence since its binary form is 1011101 and the composition [1,1,3,1,1] is palindromic. On the other hand, 132 is not in the sequence since its binary form is 10000100 and the composition [1,4,1,2] is not palindromic. The command c(n) from the Maple program yields the composition having index n. - _Emeric Deutsch_, Jan 28 2018

%H Rémy Sigrist, <a href="/A044918/b044918.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A044918/a044918.png">Logarithmic scatterplot of (n, a(n+1)-a(n)) for n = 1..9999</a>

%p Runs:=proc(L) local j,r,i,k:j:=1: r[j]:=L[1]: for i from 2 to nops(L) do if L[i]=L[i-1] then r[j]:=r[j], L[i] else j:=j+1: r[j]:=L[i] end if end do: [seq([r[k]],k=1..j)] end proc: RunLengths:=proc(L) map(nops,Runs(L)) end proc: c:=proc(n) ListTools:-Reverse(convert(n,base,2)): RunLengths(`%`) end proc: A:={}: for n from 1 to 500 do crev(n):=[seq(c(n)[1+ nops(c(n))-j],j=1..nops(c(n)))] od: for n from 1 to 500 do if c(n)=crev(n) then A:=A union {n} else fi od: A; # most of the Maple program is due to W. Edwin Clark. # _Emeric Deutsch_, Jan 28 2018

%t Position[Array[Length /@ Split@ IntegerDigits[#, 2] &, 400], _? PalindromeQ, 1] // Flatten (* _Michael De Vlieger_, Jan 28 2018 *)

%o (PARI) ispal(v) = {for(i=1, #v\2, if (v[i] != v[#v-i+1], return(0));); return(1);}

%o isok(n) = {b = binary(n); lastb = b[1]; vrun = vector(1); vrun[1] = 1; for (i=2, #b, if (b[i] != lastb, vrun = concat(vrun, 1); lastb = b[i];, vrun[#vrun]++;)); return (ispal(vrun));} \\ _Michel Marcus_, Jul 10 2013

%Y Cf. A006995, A035928. - _Leroy Quet_, Sep 14 2009

%Y Cf. A298644, A101211. - _Emeric Deutsch_, Jan 28 2018

%K nonn,base

%O 1,2

%A _Clark Kimberling_