OFFSET
1,4
FORMULA
a(n) <= A079842(n).
If n is a palindromic square, then a(n) >= n.
EXAMPLE
Note that a(4) = a(13) = a(22) = 121 as the digits of 121 can be partitioned as 1+2+1 or 12+1 or 1+21.
PROG
(Python)
from collections import Counter
from operator import itemgetter
from sympy.ntheory.primetest import is_square
from sympy.utilities.iterables import partitions, multiset_permutations
def A370512(n):
smax, m = 0, 0
for s, p in sorted(partitions(n, size=True), key=itemgetter(0), reverse=True):
if s<smax:
break
q = tuple(Counter(p).elements())
c = sum((Counter(str(d)) for d in q), start=Counter())
if len(tuple(filter(lambda x:x&1, c.values()))) <= 1:
for a in multiset_permutations(q):
if (b:=''.join(str(d) for d in a))==b[::-1] and is_square(k:=int(b)):
m = max(k, m)
if m>0:
smax=s
return m
CROSSREFS
KEYWORD
nonn,more,base
AUTHOR
Chai Wah Wu, Feb 20 2024
STATUS
approved