Largest int from concatenated ints: Difference between revisions

Line 263:
 
===Python: Compare repeated string method===
<lang python>def lcmmaxnum(valuesx):
maxlen = lcm(len(nstr(max(x)) for n in y)
"Lowest common multiple by 'Iteration over multiples'"
valuesreturn = set''.join([abssorted(int(str(v)) for v in values]x), reverse=True,
key=lambda i: i*(maxlen * 2 // len(i))))
if values and 0 not in values:
n = n0 = max(values)
values.remove(n)
while any( n % m for m in values ):
n += n0
return n
return 0
def maxnum(x):
y = [str(n) for n in x]
maxlen = lcm(len(n) for n in y)
return ''.join(sorted((n for n in y), reverse=True,
key=lambda i: i*(maxlen // len(i))))
 
for numbers in [(212, 21221), (1, 34, 3, 98, 9, 76, 45, 4), (54, 546, 548, 60)]:
Anonymous user