OFFSET
0,3
COMMENTS
Leading zeros are forbidden in the decimal representation of n; however we allow leading zeros in the palindromic parts.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
Rémy Sigrist, PARI program for A331472
FORMULA
a(n) <= n with equality iff n belongs to A002113.
EXAMPLE
For n = 1664:
- we can split this number into "1" and "6" and "6" and "4",
- or into "1" and "66" and "4",
- hence a(1664) = max(16, 71) = 71.
MATHEMATICA
palQ[w_] := w == Reverse@w; ric[tg_, cr_] := Block[{m = Length@tg, t}, If[m == 0, Sow@ Total[ FromDigits /@ 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, 1]]]; a /@ Range[0, 99] (* Giovanni Resta, Jan 19 2020 *)
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jan 17 2020
STATUS
approved