# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/
Search: id:a044918
Showing 1-1 of 1
%I A044918 #36 Apr 13 2021 23:19:05
%S A044918 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 A044918 99,107,119,127,129,142,150,153,165,170,178,189,195,204,212,219,231,
%U A044918 232,240,255,257,273,297,313,325,341,365,381
%N A044918 Positive integers whose base-2 run lengths form a palindrome.
%C A044918 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 A044918 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 A044918 Rémy Sigrist, Table of n, a(n) for n = 1..10000
%H A044918 Rémy Sigrist, Logarithmic scatterplot of (n, a(n+1)-a(n)) for n = 1..9999
%p A044918 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 A044918 Position[Array[Length /@ Split@ IntegerDigits[#, 2] &, 400], _? PalindromeQ, 1] // Flatten (* _Michael De Vlieger_, Jan 28 2018 *)
%o A044918 (PARI) ispal(v) = {for(i=1, #v\2, if (v[i] != v[#v-i+1], return(0));); return(1);}
%o A044918 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 A044918 Cf. A006995, A035928. - _Leroy Quet_, Sep 14 2009
%Y A044918 Cf. A298644, A101211. - _Emeric Deutsch_, Jan 28 2018
%K A044918 nonn,base
%O A044918 1,2
%A A044918 _Clark Kimberling_
# Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE