Jump to content

Next highest int from digits: Difference between revisions

m
→‎Python: Generator: Fix for a premature generator depletion - corrected output
(→‎{{header|Go}}: Removed superfluous import.)
m (→‎Python: Generator: Fix for a premature generator depletion - corrected output)
Line 447:
<lang python>'''Digit-shuffle successors'''
 
from itertools import chain, islice, permutations, tee
 
 
Line 471:
def showSuccs(n):
def go(xs):
harvestys, zs = take(n)tee(xs)
harvest = take(5)(ys)
return (
repr(len(harvest)) + ' of ' + repr(len(list(xszs))) + ': '
).rjust(12, ' ') + repr(harvest)
return lambda xs: go(xs)
Line 545 ⟶ 546:
0 -> 0 of 0: []
9 -> 0 of 0: []
12 -> 1 of 01: [21]
21 -> 0 of 0: []
12453 -> 5 of 111116: [12534, 12543, 13245, 13254, 13425]
738440 -> 5 of 9196: [740348, 740384, 740438, 740483, 740834]
45072010 -> 5 of 18561861: [45072100, 45100027, 45100072, 45100207, 45100270]
95322020 -> 1 of 01: [95322200]</pre>
 
=={{header|REXX}}==
9,659

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.