Count the coins/0-1: Difference between revisions

m
(J)
m (→‎{{header|J}}: spelling)
Line 132:
ccoins=: {{ (#i), +/!x:+/"1 i=. x selcoins y }}</lang>
 
<code>selcoins</code> identifies the valid selections of the coins. <code>ccoins</code> counts thenthem, giving two counts (first is where coin order does not matter, second is where each permutation of physical coins is counted separately).
 
Task examples:<lang J> 6 ccoins 1 2 3 4 5
6,951

edits