OFFSET
0,4
COMMENTS
Leading zeros are forbidden in the binary representation of n; however we allow leading zeros in the palindromic parts.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
Rémy Sigrist, PARI program for A331471
FORMULA
EXAMPLE
For n = 10:
- the binary representation of 10 is "1010",
- we can split it into "1" and "0" and "1" and "0" (1 and 0 and 1 and 0),
- or into "101" and "0" (5 and 0),
- or into "1" and "010" (1 and 2),
- hence a(n) = max(2, 5, 3) = 5.
MATHEMATICA
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 *)
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 17 2020
STATUS
approved