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
1, 2, 111, 112, 5, 11112, 21112, 1111112, 111111111, 10, 110, 11111111112, 21112111111, 112111111112, 11111111115, 11111111112112, 211111111121111, 11111111111111112, 21111111211111111, 20, 21111111111111111111, 21111111111111111112, 211121111111111111111 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Any ordering of terms of the partition can be used before concatenation. - D. S. McNeil, May 09 2010
LINKS
EXAMPLE
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.
a(6) = 11112 (all partitions with one even part give multiples of 6 and 11112 is the largest).
PROG
(Python)
from collections import Counter
from operator import itemgetter
from sympy.utilities.iterables import partitions, multiset_permutations
def A079840(n):
smax, m = 0, 0
for s, p in sorted(partitions(n, size=True), key=itemgetter(0), reverse=True):
if s<smax:
break
if n % 10 or '0' in ''.join(str(d%10) for d in p):
for a in multiset_permutations(Counter(p).elements()):
if not (k:=int(''.join(str(d) for d in a))) % n:
m = max(k, m)
if m>0:
smax=s
return m # Chai Wah Wu, Feb 22 2024
CROSSREFS
Sequence in context: A093425 A091508 A075399 * A231278 A117698 A274057
KEYWORD
nonn,base,changed
AUTHOR
Amarnath Murthy, Feb 16 2003
EXTENSIONS
Edited by D. S. McNeil, May 09 2010
At the suggestion of Charles R Greathouse IV, corrected and extended by D. S. McNeil, May 09 2010
a(22)-a(23) from Chai Wah Wu, Feb 22 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 March 29 02:23 EDT 2024. Contains 371264 sequences. (Running on oeis4.)