Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 11467
11 votes
Accepted

How do I get a list of all possible sums in a list nested list?

Total[Tuples@rn, {2}] should do. … For cases where a very large number of tuples would be generated, Fold[Total[Tuples[{##}], {2}] &, rn] will generally be even quicker, and exhibit considerably lower memory pressure, to the point that …
ciao's user avatar
  • 26k
11 votes

List of tuples without duplicates & repeated values

The accepted answer will quickly blow up with arguments of more than trivial sizes. For example, with vals = {10, 20, 5, a, b, c} and n=10, it takes nearly two minutes to finish on my laptop, generati …
ciao's user avatar
  • 26k