McNuggets problem: Difference between revisions

m
J draft
(Added Kotlin)
m (J draft)
Line 88:
</pre>
 
=={{header|J}}==
 
Brute force solution: calculate all pure (just one kind of box) McNugget numbers which do not exceed 100, then compute all possible sums, and then remove those from the list of numbers up to 100 (which is obviously a McNugget number), then find the largest number remaining:
 
<lang J> >./(i.100)-.,+/&>{(* i.@>.@%~&101)&.>6 9 20
43</lang>
 
Technically, we could have used 100 in place of 101 when we were finding how many pure McNugget numbers were in each series (because 100 is obviously a McNugget number), but it's not like that's a problem, either.
=={{header|Kotlin}}==
{{trans|Go}}
6,962

edits