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!)
A079840 Largest multiple of n as a concatenation of its partitions. 1

%I #19 Mar 22 2024 18:18:27

%S 1,2,111,112,5,11112,21112,1111112,111111111,10,110,11111111112,

%T 21112111111,112111111112,11111111115,11111111112112,211111111121111,

%U 11111111111111112,21111111211111111,20,21111111111111111111,21111111111111111112,211121111111111111111

%N Largest multiple of n as a concatenation of its partitions.

%C Any ordering of terms of the partition can be used before concatenation. - _D. S. McNeil_, May 09 2010

%H Chai Wah Wu, <a href="/A079840/b079840.txt">Table of n, a(n) for n = 1..49</a>

%e a(4) = 112: the partitions of 4 are 4,(3,1),(2,2),(1,1,2),(1,1,1,1). There are two multiples of 4, i.e., 4 and 112.

%e a(6) = 11112 (all partitions with one even part give multiples of 6 and 11112 is the largest).

%o (Python)

%o from collections import Counter

%o from operator import itemgetter

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

%o def A079840(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 if n % 10 or '0' in ''.join(str(d%10) for d in p):

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

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

%o m = max(k,m)

%o if m>0:

%o smax=s

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

%K nonn,base

%O 1,2

%A _Amarnath Murthy_, Feb 16 2003

%E Edited by _D. S. McNeil_, May 09 2010

%E At the suggestion of _Charles R Greathouse IV_, corrected and extended by _D. S. McNeil_, May 09 2010

%E a(22)-a(23) from _Chai Wah Wu_, Feb 22 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 April 25 01:35 EDT 2024. Contains 371964 sequences. (Running on oeis4.)