login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A044918 Positive integers whose base-2 run lengths form a palindrome. 6
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, 99, 107, 119, 127, 129, 142, 150, 153, 165, 170, 178, 189, 195, 204, 212, 219, 231, 232, 240, 255, 257, 273, 297, 313, 325, 341, 365, 381 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
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
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
LINKS
MAPLE
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
MATHEMATICA
Position[Array[Length /@ Split@ IntegerDigits[#, 2] &, 400], _? PalindromeQ, 1] // Flatten (* Michael De Vlieger, Jan 28 2018 *)
PROG
(PARI) ispal(v) = {for(i=1, #v\2, if (v[i] != v[#v-i+1], return(0)); ); return(1); }
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
CROSSREFS
Cf. A006995, A035928. - Leroy Quet, Sep 14 2009
Cf. A298644, A101211. - Emeric Deutsch, Jan 28 2018
Sequence in context: A022847 A047371 A327492 * A103635 A133677 A362403
KEYWORD
nonn,base
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 3 10:11 EDT 2024. Contains 374885 sequences. (Running on oeis4.)