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!)
A331471 Consider the different ways to split the binary representation of n into palindromic parts; a(n) is the greatest possible sum of the parts of such a split. 2

%I #12 Jan 19 2020 05:03:57

%S 0,1,1,3,1,5,3,7,1,9,5,6,3,6,7,15,1,17,9,10,5,21,7,8,3,10,6,27,7,8,15,

%T 31,1,33,17,18,9,10,10,12,5,10,21,22,7,45,15,16,3,18,10,51,6,22,27,28,

%U 7,12,9,28,15,16,31,63,1,65,33,34,17,18,18,20,9,73

%N Consider the different ways to split the binary representation of n into palindromic parts; a(n) is the greatest possible sum of the parts of such a split.

%C Leading zeros are forbidden in the binary representation of n; however we allow leading zeros in the palindromic parts.

%H Rémy Sigrist, <a href="/A331471/b331471.txt">Table of n, a(n) for n = 0..8192</a>

%H Rémy Sigrist, <a href="/A331471/a331471.gp.txt">PARI program for A331471</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) >= A000120(n) with equality iff n = 0 or n is a power of 2.

%F a(n) <= n with equality iff n belongs to A006995.

%e For n = 10:

%e - the binary representation of 10 is "1010",

%e - we can split it into "1" and "0" and "1" and "0" (1 and 0 and 1 and 0),

%e - or into "101" and "0" (5 and 0),

%e - or into "1" and "010" (1 and 2),

%e - hence a(n) = max(2, 5, 3) = 5.

%t palQ[w_] := w == Reverse@w; ric[tg_, cr_] := Block[{m = Length@tg, t}, If[m == 0, Sow@ Total[ FromDigits[#, 2] & /@ cr], Do[ If[ palQ[t = Take[tg, k]], ric[Drop[tg, k], Join[cr, {t}]]], {k, m}]]]; a[n_] := Max[ Reap[ ric[ IntegerDigits[n, 2], {}]][[2, 1]]]; a /@ Range[0, 73] (* _Giovanni Resta_, Jan 19 2020 *)

%o (PARI) See Links section.

%Y Cf. A000120, A006995, A215244, A331362.

%K nonn,base

%O 0,4

%A _Rémy Sigrist_, Jan 17 2020

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 April 18 13:50 EDT 2024. Contains 371780 sequences. (Running on oeis4.)