Jump to content

Last list item: Difference between revisions

add BQN
(Added XPL0 example.)
(add BQN)
Line 192:
sum=621
</pre>
 
=={{header|BQN}}==
 
===With and without sorting===
 
<lang bqn>list ← ⟨6, 81, 243, 14, 25, 49, 123, 69, 11⟩
 
W_sort ← {{i←2↑∧𝕩, (𝕩/˜¬𝕩∊i)∾+´i}⍟(↕≠𝕩)𝕩}
 
WO_sort ← {{m←⌊´𝕩, n←⌊´𝕩/˜¬m=𝕩, (𝕩/˜¬𝕩∊m‿n)∾m+n}⍟(↕≠𝕩)𝕩}
 
•Show¨W_sort list
•Show¨WO_sort list</lang>
<lang>⟨ 6 81 243 14 25 49 123 69 11 ⟩
⟨ 81 243 14 25 49 123 69 17 ⟩
⟨ 81 243 25 49 123 69 31 ⟩
⟨ 81 243 49 123 69 56 ⟩
⟨ 81 243 123 69 105 ⟩
⟨ 243 123 105 150 ⟩
⟨ 243 150 228 ⟩
⟨ 243 378 ⟩
⟨ 621 ⟩
⟨ 6 81 243 14 25 49 123 69 11 ⟩
⟨ 81 243 14 25 49 123 69 17 ⟩
⟨ 81 243 25 49 123 69 31 ⟩
⟨ 81 243 49 123 69 56 ⟩
⟨ 81 243 123 69 105 ⟩
⟨ 243 123 105 150 ⟩
⟨ 243 150 228 ⟩
⟨ 243 378 ⟩
⟨ 621 ⟩</lang>
 
=={{header|C}}==
236

edits

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