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!)
A079842 Largest square which is a concatenation of partitions of n; or 0 if no such number exists. 2

%I #17 Feb 21 2024 14:42:35

%S 1,0,0,121,0,0,25,0,12321,2116,0,0,5112121,0,0,121242121,0,1121513121,

%T 2511112321,0,0,213223221121,0,0,1212111311221321,0,4231211211113121,

%U 1111111222222225,0,0,111131111122142224,0,0,11111111122222222225

%N Largest square which is a concatenation of partitions of n; or 0 if no such number exists.

%F If n is square, then a(n) >= n.

%e a(4) = 121 though 4 itself is a square. a(7) = 25 (16 is also a square).

%o (Python)

%o from collections import Counter

%o from operator import itemgetter

%o from sympy.ntheory.primetest import is_square

%o from sympy.utilities.iterables import partitions, multiset_permutations

%o def A079842(n):

%o smax, m = 0, 0

%o for s, p in sorted(partitions(n,size=True),key=itemgetter(0),reverse=True):

%o if s<smax:

%o break

%o for a in multiset_permutations(Counter(p).elements()):

%o if is_square(k:=int(''.join(str(d) for d in a))):

%o m = max(k,m)

%o if m>0:

%o smax=s

%o return m # _Chai Wah Wu_, Feb 20 2024

%K base,more,nonn

%O 1,4

%A _Amarnath Murthy_, Feb 16 2003

%E More terms from _Michel ten Voorde_ Jun 20 2003

%E a(23)-a(32) from _Chai Wah Wu_, Feb 20 2024

%E a(33)-a(34) from _Chai Wah Wu_, Feb 21 2024

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 May 9 04:22 EDT 2024. Contains 372341 sequences. (Running on oeis4.)