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!)
A370512 Largest palindromic square which is a concatenation of partitions of n; or 0 if no such number exists. 1
1, 0, 0, 121, 0, 0, 0, 0, 12321, 0, 0, 0, 121, 0, 0, 121242121, 0, 12321, 5221225, 0, 0, 121, 0, 0, 1212225222121, 0, 12321, 5221225, 0, 0, 10201, 0, 0, 1212225222121, 0, 12122232623222121 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
LINKS
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
Sequence in context: A033187 A106547 A106544 * A079842 A014756 A014748
KEYWORD
nonn,more,base
AUTHOR
Chai Wah Wu, Feb 20 2024
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 April 26 21:53 EDT 2024. Contains 372004 sequences. (Running on oeis4.)