Jump to content

Practical numbers: Difference between revisions

m
→‎{{Header|Python}}: Huge mem saver.
m (→‎{{header|Raku}}: Better variable name, stretchy)
m (→‎{{Header|Python}}: Huge mem saver.)
Line 46:
def powerset(s: List[int]) -> List[Tuple[int, ...]]:
"""powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3) ."""
return list(chain.from_iterable(combinations(s, r) for r in range(len(s)+1)))
 
# %% Practical number
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.